modules/test: switch to runCommand

This commit is contained in:
Matt Sturgeon 2024-08-24 20:03:04 +01:00
parent 1085bcd7cc
commit af31063538
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -46,15 +46,7 @@ in
}; };
}; };
config = { config =
test.derivation = pkgs.stdenv.mkDerivation {
inherit (cfg) name;
dontUnpack = true;
nativeBuildInputs = [ config.finalPackage ];
# First check warnings/assertions, then run nvim
buildPhase =
let let
showErr = showErr =
name: lines: name: lines:
@ -72,6 +64,11 @@ in
err + showErr name lines err + showErr name lines
) "" toCheck; ) "" toCheck;
in in
{
test.derivation =
pkgs.runCommandNoCCLocal cfg.name { nativeBuildInputs = [ config.finalPackage ]; }
(
# First check warnings/assertions, then run nvim
lib.optionalString (errors != "") '' lib.optionalString (errors != "") ''
echo -n ${lib.escapeShellArg errors} echo -n ${lib.escapeShellArg errors}
exit 1 exit 1
@ -88,12 +85,10 @@ in
echo "ERROR: $output" echo "ERROR: $output"
exit 1 exit 1
fi fi
''; ''
+ ''
# If we don't do this nix is not happy
installPhase = ''
touch $out touch $out
''; ''
}; );
}; };
} }