diff options
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/flake.nix b/flake.nix index 8df1039..c101218 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,9 @@ in { nixosModules.default = { ... }: { imports = [ + # Please note that checks.nix also directly references options.nix, + # so if you add anything else to these imports, also add it in + # checks.nix. ./options.nix ]; }; @@ -47,44 +50,11 @@ }; }); + # The checks are quite verbose, so they're in a separate file. checks = forAllSystems (system: - let pkgs = nixpkgsFor.${system}; - mkNixEvalCheck = name: input: expected: pkgs.stdenv.mkDerivation { - name = "smalltech-nix-test-${name}"; - - src = pkgs.symlinkJoin { - name = "smalltech-nix-test-${name}-src"; - paths = [ - (pkgs.writeTextDir "input" input) - (pkgs.writeTextDir "expected" "${expected}\n") - ]; - }; - - dontUnpack = true; - - nativeBuildInputs = with pkgs; [ diffutils nix ]; - - buildPhase = '' - mkdir nix-store - ${pkgs.nix}/bin/nix \ - --extra-experimental-features nix-command \ - --store dummy:// \ - eval --json --file $src/input > $out - - if ! ${pkgs.diffutils}/bin/diff $src/expected $out; then - echo - echo "This is a nix evaluation test case. The expected eval" - echo "output differed from the actual output. In an ideal" - echo "world, the above diff would help you understand why." - echo - false - fi - ''; - }; - in { - nix-trivial = mkNixEvalCheck "trivial" "1 + 2" "3"; - - rust = self.packages.${system}.default; - }); + let pkgs = nixpkgsFor.${system}; + in import ./checks.nix { + inherit pkgs self system; + }); }; } |