Files
clan-core/lib/values/flake-module.nix
DavHau 3ec028d672 tests: reduce unnecessary rebuilds of several tests
Some test were referring to the whole source code via ${self} which amde them rebuild on every single commit.

This is not mitigated by introduceing `self.filter { include = [...]; }` allowin to a content addressed subset of the source code in tests.
2025-01-17 17:00:18 +07:00

43 lines
1022 B
Nix

{ self, inputs, ... }:
let
inputOverrides = builtins.concatStringsSep " " (
builtins.map (input: " --override-input ${input} ${inputs.${input}}") (builtins.attrNames inputs)
);
in
{
perSystem =
{
pkgs,
system,
lib,
...
}:
let
tests = import ./test.nix { inherit lib; };
in
{
legacyPackages.evalTests-values = tests;
checks = {
lib-values-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)"
nix-unit --eval-store "$HOME" \
--extra-experimental-features flakes \
${inputOverrides} \
--flake ${
self.filter {
include = [
"flakeModules"
"lib/default.nix"
"lib/flake-module.nix"
"lib/values"
];
}
}#legacyPackages.${system}.evalTests-values
touch $out
'';
};
};
}