jail.nix/tests/flake.nix

40 lines
1.2 KiB
Nix
Raw Normal View History

2025-07-17 20:25:17 -07:00
{
# This is a separate flake file from the one at the root because we don't
# want to depend on nixpkgs
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
outputs = { nixpkgs, ... }: let
pkgs = import nixpkgs { system = "x86_64-linux"; };
lib = pkgs.lib;
2025-08-19 00:08:44 -07:00
haskellPackages = pkgs.haskellPackages.callCabal2nix "jail-nix-tests" ./. { };
testDependencies = [
(pkgs.haskellPackages.ghc.withPackages (p: haskellPackages.buildInputs))
pkgs.cabal-install
];
2025-07-17 20:25:17 -07:00
in {
apps.x86_64-linux.runChecks = {
type = "app";
program = lib.getExe (pkgs.writeShellApplication {
name = "run-all-jail-nix-tests";
2025-08-19 00:08:44 -07:00
runtimeInputs = testDependencies;
text = ''
2025-08-19 00:08:44 -07:00
${lib.pipe {
jail-nix = ../.;
nixpkgs = nixpkgs;
} [
(lib.mapAttrsToList (name: path: "${name}=${path}"))
(lib.concatStringsSep " ")
2025-08-19 00:08:44 -07:00
(lib.toShellVar "NIX_PATH")
]} cabal test
'';
});
};
2025-08-19 00:08:44 -07:00
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = testDependencies ++ [
(pkgs.haskell-language-server.override { dynamic = true; })
pkgs.ghcid
pkgs.hpack
];
};
2025-07-17 20:25:17 -07:00
};
}