2023-08-28 17:47:15 +03:00
|
|
|
# evaluate packages from `/**/modules/drvs` and export them via `flake.packages`
|
|
|
|
{self, ...}: {
|
|
|
|
perSystem = {
|
|
|
|
pkgs,
|
|
|
|
inputs',
|
2023-09-20 23:03:03 +03:00
|
|
|
lib,
|
|
|
|
system,
|
2023-08-28 17:47:15 +03:00
|
|
|
...
|
2023-09-28 20:19:40 +03:00
|
|
|
}: let
|
2023-11-01 19:54:06 +03:00
|
|
|
dream2nixFlake = import ../../. {};
|
|
|
|
inputs = lib.mapAttrs (name: input: "${input.outPath}") dream2nixFlake.inputs;
|
2023-09-28 20:19:40 +03:00
|
|
|
inputsFile = builtins.toFile "inputs.json" (builtins.toJSON inputs);
|
|
|
|
in
|
2023-09-20 23:03:03 +03:00
|
|
|
lib.optionalAttrs (system == "x86_64-linux") {
|
|
|
|
# map all modules in /examples to a package output in the flake.
|
2023-09-28 20:19:40 +03:00
|
|
|
checks.nix-unit =
|
|
|
|
pkgs.runCommand "nix-unit-tests" {
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.nix
|
|
|
|
];
|
|
|
|
} ''
|
|
|
|
export NIX_PATH=nixpkgs=${pkgs.path}
|
|
|
|
export HOME=$(realpath .)
|
2023-11-01 19:54:06 +03:00
|
|
|
for test in ${../..}/tests/nix-unit/*; do
|
2023-09-28 20:19:40 +03:00
|
|
|
if [ -f "$test" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
echo -e "Executing tests from file $test"
|
|
|
|
${inputs'.nix-unit.packages.nix-unit}/bin/nix-unit \
|
|
|
|
"$test" \
|
|
|
|
--eval-store $(realpath .) \
|
|
|
|
--arg inputs 'builtins.fromJSON (builtins.readFile ${inputsFile})'
|
|
|
|
done
|
|
|
|
touch $out
|
|
|
|
'';
|
2023-09-20 23:03:03 +03:00
|
|
|
};
|
2023-08-28 17:47:15 +03:00
|
|
|
}
|