mirror of
https://codeberg.org/icewind/mill-scale.git
synced 2026-06-03 18:04:09 +02:00
also pass packageOpts to checks
This commit is contained in:
parent
8051d16230
commit
9484c39cb9
1 changed files with 37 additions and 31 deletions
|
|
@ -9,7 +9,7 @@ let
|
||||||
inherit (lib.fileset) fileFilter toSource unions;
|
inherit (lib.fileset) fileFilter toSource unions;
|
||||||
inherit (flakelight.types) fileset function optFunctionTo;
|
inherit (flakelight.types) fileset function optFunctionTo;
|
||||||
|
|
||||||
filteredSrc = toSource { root = src; fileset = unions (config.extraPaths ++ [config.fileset]); };
|
filteredSrc = toSource { root = src; fileset = unions (config.extraPaths ++ [ config.fileset ]); };
|
||||||
cargoToml = fromTOML (readFile (src + /Cargo.toml));
|
cargoToml = fromTOML (readFile (src + /Cargo.toml));
|
||||||
tomlPackage = cargoToml.package or cargoToml.workspace.package;
|
tomlPackage = cargoToml.package or cargoToml.workspace.package;
|
||||||
hasMsrv = tomlPackage ? rust-version;
|
hasMsrv = tomlPackage ? rust-version;
|
||||||
|
|
@ -110,14 +110,14 @@ warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
|
||||||
msrvToolchain = mkOption {
|
msrvToolchain = mkOption {
|
||||||
type = function;
|
type = function;
|
||||||
default = pkgs: pkgs.rust-bin.stable.${msrv}.default;
|
default = pkgs: pkgs.rust-bin.stable.${msrv}.default;
|
||||||
description = "rust toolchain to use";
|
description = "rust toolchain to use for msrv check";
|
||||||
};
|
};
|
||||||
miriToolchain = mkOption {
|
miriToolchain = mkOption {
|
||||||
type = function;
|
type = function;
|
||||||
default = pkgs: pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
|
default = pkgs: pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
|
||||||
extensions = [ "miri" "rust-src" ];
|
extensions = [ "miri" "rust-src" ];
|
||||||
});
|
});
|
||||||
description = "rust toolchain to use";
|
description = "rust toolchain to use for miri";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -238,22 +238,28 @@ warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
|
||||||
, crateName
|
, crateName
|
||||||
, pkgs
|
, pkgs
|
||||||
, ...
|
, ...
|
||||||
}: {
|
}:
|
||||||
test = craneLib.cargoTest {
|
let
|
||||||
|
packageOpts = config.packageOpts pkgs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
test = craneLib.cargoTest ({
|
||||||
src = filteredSrc;
|
src = filteredSrc;
|
||||||
inherit cargoArtifacts;
|
inherit cargoArtifacts;
|
||||||
cargoExtraArgs = "--locked --all-targets --workspace";
|
cargoExtraArgs = "--locked --all-targets --workspace";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
clippy = craneLib.cargoClippy {
|
clippy = craneLib.cargoClippy ({
|
||||||
src = filteredSrc;
|
src = filteredSrc;
|
||||||
inherit cargoArtifacts;
|
inherit cargoArtifacts;
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
cargoClippyExtraArgs = "--all-targets ${maybeWorkspace} -- --deny warnings";
|
cargoClippyExtraArgs = "--all-targets ${maybeWorkspace} -- --deny warnings";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
} // (optionalAttrs hasMsrv {
|
} // (optionalAttrs hasMsrv
|
||||||
msrv = craneLibMsrv.buildPackage {
|
{
|
||||||
|
msrv = craneLibMsrv.buildPackage
|
||||||
|
({
|
||||||
src = filteredSrc;
|
src = filteredSrc;
|
||||||
pname = "${crateName}-msrv";
|
pname = "${crateName}-msrv";
|
||||||
cargoArtifacts = cargoArtifactsMsrv;
|
cargoArtifacts = cargoArtifactsMsrv;
|
||||||
|
|
@ -263,43 +269,43 @@ warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
|
||||||
cargoExtraArgs = "--release --locked --all-targets --all-features ${maybeWorkspace}";
|
cargoExtraArgs = "--release --locked --all-targets --all-features ${maybeWorkspace}";
|
||||||
installPhaseCommand = "mkdir $out";
|
installPhaseCommand = "mkdir $out";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
}) // (optionalAttrs hasFeatures {
|
}) // (optionalAttrs hasFeatures {
|
||||||
test-all-features = craneLib.cargoTest {
|
test-all-features = craneLib.cargoTest ({
|
||||||
src = filteredSrc;
|
src = filteredSrc;
|
||||||
pname = "${crateName}-all-features";
|
pname = "${crateName}-all-features";
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
cargoArtifacts = cargoArtifactsAllFeatures;
|
cargoArtifacts = cargoArtifactsAllFeatures;
|
||||||
cargoExtraArgs = "--locked --all-targets --all-features ${maybeWorkspace}";
|
cargoExtraArgs = "--locked --all-targets --all-features ${maybeWorkspace}";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
clippy-all-features = craneLib.cargoClippy {
|
clippy-all-features = craneLib.cargoClippy ({
|
||||||
src = filteredSrc;
|
src = filteredSrc;
|
||||||
pname = "${crateName}-all-features";
|
pname = "${crateName}-all-features";
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
cargoArtifacts = cargoArtifactsAllFeatures;
|
cargoArtifacts = cargoArtifactsAllFeatures;
|
||||||
cargoClippyExtraArgs = "--all-targets ${maybeWorkspace} --all-features -- --deny warnings";
|
cargoClippyExtraArgs = "--all-targets ${maybeWorkspace} --all-features -- --deny warnings";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
}) // (optionalAttrs hasDefaultFeatures {
|
}) // (optionalAttrs hasDefaultFeatures {
|
||||||
test-no-default-features = craneLib.cargoTest {
|
test-no-default-features = craneLib.cargoTest ({
|
||||||
src = filteredSrc;
|
src = filteredSrc;
|
||||||
pname = "${crateName}-no-default-features";
|
pname = "${crateName}-no-default-features";
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
cargoArtifacts = cargoArtifactsNoDefault;
|
cargoArtifacts = cargoArtifactsNoDefault;
|
||||||
cargoExtraArgs = "--locked --all-targets --no-default-features ${maybeWorkspace}";
|
cargoExtraArgs = "--locked --all-targets --no-default-features ${maybeWorkspace}";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
clippy-no-default-features = craneLib.cargoClippy {
|
clippy-no-default-features = craneLib.cargoClippy ({
|
||||||
inherit src;
|
inherit src;
|
||||||
pname = "${crateName}-no-default-features";
|
pname = "${crateName}-no-default-features";
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
cargoArtifacts = cargoArtifactsNoDefault;
|
cargoArtifacts = cargoArtifactsNoDefault;
|
||||||
cargoClippyExtraArgs = "--all-targets ${maybeWorkspace} --no-default-features -- --deny warnings";
|
cargoClippyExtraArgs = "--all-targets ${maybeWorkspace} --no-default-features -- --deny warnings";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
}) // (optionalAttrs hasExamples {
|
}) // (optionalAttrs hasExamples {
|
||||||
examples = craneLibMsrv.buildPackage {
|
examples = craneLibMsrv.buildPackage ({
|
||||||
src = filteredSrc;
|
src = filteredSrc;
|
||||||
pname = "${crateName}-examples";
|
pname = "${crateName}-examples";
|
||||||
cargoArtifacts = if hasFeatures then cargoArtifactsAllFeatures else cargoArtifacts;
|
cargoArtifacts = if hasFeatures then cargoArtifactsAllFeatures else cargoArtifacts;
|
||||||
|
|
@ -307,7 +313,7 @@ warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
cargoExtraArgs = "--examples ${optionalString hasFeatures "--all-features"} ${maybeWorkspace}";
|
cargoExtraArgs = "--examples ${optionalString hasFeatures "--all-features"} ${maybeWorkspace}";
|
||||||
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
inherit ((buildDeps pkgs)) buildInputs nativeBuildInputs;
|
||||||
};
|
} // packageOpts);
|
||||||
});
|
});
|
||||||
|
|
||||||
apps = { cargo-miri, cargo-semver-checks, ... }: {
|
apps = { cargo-miri, cargo-semver-checks, ... }: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue