Run Cabal test-suites as Nix checks

This commit is contained in:
Greg Pfeil 2024-06-01 02:41:45 -06:00
parent 8d17d35439
commit 635f0c9438
No known key found for this signature in database
GPG Key ID: 1193ACD196ED61F2
2 changed files with 18 additions and 1 deletions

View File

@ -139,6 +139,8 @@
// renameAttrs (name: "cabal-${name}") haskell-nix-flake.devShells
// {default = self.devShells."${system}".only-tools-nixpkgs;};
checks = renameAttrs (name: "component-${name}") haskell-nix-flake.checks;
formatter = pkgs.alejandra;
});
}

View File

@ -73,10 +73,25 @@
};
}
// localPackageDevShells;
checks =
haskell-nix-flake.checks
// {
## This check has a test that tries to write to $HOME, so we give it a fake one.
"unison-cli:test:cli-tests" = haskell-nix-flake.checks."unison-cli:test:cli-tests".overrideAttrs (old: {
## The builder here doesnt `runHook preBuild`, so we just prepend onto `buildPhase`.
buildPhase =
''
export HOME="$TMP/fake-home"
mkdir -p "$HOME"
''
+ old.buildPhase or "";
});
};
in
haskell-nix-flake
// {
defaultPackage = haskell-nix-flake.packages."unison-cli-main:exe:unison";
inherit (pkgs) unison-project;
inherit devShells localPackageNames;
inherit checks devShells localPackageNames;
}