mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 06:21:30 +03:00
d8e4b477e3
The goal is to reduce the flake inputs visible to the user Still, the top-level flake re-exposes the outputs of the dev-flake, but without exposing its inputs. This means a devShell is still available in the top-level, for example. This also removes the /modules/flake.nix. Its original purpose was separating the modules inputs from the development inputs, but this is now done the opposite way around by moving the dev inputs to /dev-flake/flake.nix.
38 lines
1.1 KiB
Nix
38 lines
1.1 KiB
Nix
# evaluate packages from `/**/modules/drvs` and export them via `flake.packages`
|
|
{self, ...}: {
|
|
perSystem = {
|
|
pkgs,
|
|
inputs',
|
|
lib,
|
|
system,
|
|
...
|
|
}: let
|
|
dream2nixFlake = import ../../. {};
|
|
inputs = lib.mapAttrs (name: input: "${input.outPath}") dream2nixFlake.inputs;
|
|
inputsFile = builtins.toFile "inputs.json" (builtins.toJSON inputs);
|
|
in
|
|
lib.optionalAttrs (system == "x86_64-linux") {
|
|
# map all modules in /examples to a package output in the flake.
|
|
checks.nix-unit =
|
|
pkgs.runCommand "nix-unit-tests" {
|
|
nativeBuildInputs = [
|
|
pkgs.nix
|
|
];
|
|
} ''
|
|
export NIX_PATH=nixpkgs=${pkgs.path}
|
|
export HOME=$(realpath .)
|
|
for test in ${../..}/tests/nix-unit/*; do
|
|
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
|
|
'';
|
|
};
|
|
}
|