Compare commits

...

4 Commits

2 changed files with 28 additions and 5 deletions
+8
View File
@@ -37,6 +37,14 @@
krantz.rust.devDeps = lib.mkOptionDefault (with pkgs; [
espflash
]);
krantz.rust.cargoArtifacts.extraAttrs = lib.mkOptionDefault {
doCheck = false;
};
krantz.rust.package.extraAttrs = lib.mkOptionDefault {
doCheck = false;
};
};
});
};
+20 -5
View File
@@ -43,9 +43,9 @@
# Build *just* the cargo dependencies, so we can reuse
# all of that work (e.g. via cachix) when running in CI
cargoArtifacts = craneLib.buildDepsOnly {
cargoArtifacts = craneLib.buildDepsOnly ({
inherit src buildInputs nativeBuildInputs;
};
} // cfg.cargoArtifacts.extraAttrs);
in {
options.krantz.rust = {
enable = lib.mkEnableOption "building a cargo project with crane";
@@ -96,6 +96,17 @@
];
};
cargoArtifacts = {
extraAttrs = lib.mkOption {
description = "Extra attributes to merge into buildDepsOnly. See https://crane.dev/API.html#cranelibbuilddepsonly";
type = lib.types.attrs;
default = {};
example = {
doCheck = false;
};
};
};
devShell = {
enable = lib.mkEnableOption "a rust development environment" // {default = true;};
@@ -143,6 +154,8 @@
nix = lib.mkEnableOption "formatting for nix files" // {default = true;};
rust = lib.mkEnableOption "formatting for rust files" // {default = true;};
toml = lib.mkEnableOption "formatting for toml files" // {default = true;};
markdown = lib.mkEnableOption "formatting for toml files" // {default = true;};
};
checks = {
@@ -180,10 +193,9 @@
# Accessible through 'nix build', 'nix shell', 'nix run', etc
packages = lib.mkIf cfg.package.enable {
${cfg.package.name} =
craneLib.buildPackage {
craneLib.buildPackage ({
inherit src buildInputs nativeBuildInputs cargoArtifacts;
}
// cfg.package.extraAttrs;
} // cfg.package.extraAttrs);
};
# Formatter for nix files, available through 'nix fmt'
@@ -193,6 +205,9 @@
enable = true;
edition = manifest.edition;
};
taplo.enable = lib.mkIf cfg.formatter.toml true;
rumdl-check.enable = lib.mkIf cfg.formatter.markdown true;
rumdl-format.enable = lib.mkIf cfg.formatter.markdown true;
};
checks = lib.mkIf cfg.checks.enable {