mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-09-19 08:11:26 +02:00
fix(flake): make the eval-tests check a derivation
checks.<system>.eval-tests returned a boolean, so nix flake check failed with "not a derivation". Wrap the evalTests result in a runCommand so flake check actually evaluates it.
This commit is contained in:
+13
-2
@@ -154,8 +154,19 @@ in
|
||||
evalTests = lib.lists.all (it: it.evalTests == { }) allSystemValues;
|
||||
|
||||
checks = forAllSystems (system: {
|
||||
# eval-tests per system
|
||||
eval-tests = allSystems.${system}.evalTests == { };
|
||||
# eval-tests per system. `nix flake check` requires every check to be a
|
||||
# derivation, so wrap the boolean result in one instead of returning a bool.
|
||||
eval-tests =
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
results = allSystems.${system}.evalTests;
|
||||
in
|
||||
pkgs.runCommand "eval-tests" { } (
|
||||
if results == { } then
|
||||
"touch $out"
|
||||
else
|
||||
"echo 'eval tests failed: evalTests is not empty' >&2; exit 1"
|
||||
);
|
||||
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = mylib.relativeToRoot ".";
|
||||
|
||||
Reference in New Issue
Block a user