add flake module

This commit is contained in:
Emile Clark-Boman 2026-01-27 17:50:53 +10:00
parent 3fe748f174
commit bc2a62e62b
4 changed files with 84 additions and 0 deletions

34
flake/nix-unit.nix Normal file
View file

@ -0,0 +1,34 @@
{
this,
flake,
deps,
...
}: let
inherit
(deps)
nixpkgs
nix-unit
;
inherit
(this.util)
forAllSystems
;
in {
checks = forAllSystems (system: {
default =
nixpkgs.legacyPackages.${system}.runCommand "tests"
{
nativeBuildInputs = [nix-unit.packages.${system}.default];
}
''
export HOME="$(realpath .)"
# The nix derivation must be able to find all used inputs in the nix-store because it cannot download it during buildTime.
nix-unit --eval-store "$HOME" \
--extra-experimental-features flakes \
--override-input nixpkgs ${nixpkgs} \
--flake ${flake}#tests
touch $out
'';
});
}