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";
|
2025-09-11 07:31:48 -07:00
|
|
|
outputs =
|
|
|
|
|
{ nixpkgs, ... }:
|
|
|
|
|
let
|
|
|
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
|
|
|
|
lib = pkgs.lib;
|
2025-09-27 21:48:39 -07:00
|
|
|
haskellPackages = pkgs.haskell.packages.ghc984;
|
|
|
|
|
cabal2nix = haskellPackages.callCabal2nix "jail-nix-tests" ./. { };
|
2025-09-11 07:31:48 -07:00
|
|
|
testDependencies = [
|
2025-09-27 21:48:39 -07:00
|
|
|
(haskellPackages.ghc.withPackages (p: cabal2nix.buildInputs))
|
2025-09-11 07:31:48 -07:00
|
|
|
pkgs.cabal-install
|
2025-08-19 00:08:44 -07:00
|
|
|
];
|
2025-09-11 07:31:48 -07:00
|
|
|
mkApp = name: runtimeInputs: script: {
|
|
|
|
|
type = "app";
|
|
|
|
|
program = lib.getExe (
|
|
|
|
|
pkgs.writeShellApplication {
|
|
|
|
|
inherit name runtimeInputs;
|
|
|
|
|
text = script;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
apps.x86_64-linux.runTests = mkApp "run-all-jail-nix-tests" testDependencies ''
|
|
|
|
|
${
|
|
|
|
|
lib.pipe
|
|
|
|
|
{
|
|
|
|
|
jail-nix = ../.;
|
|
|
|
|
nixpkgs = nixpkgs;
|
|
|
|
|
}
|
|
|
|
|
[
|
|
|
|
|
(lib.mapAttrsToList (name: path: "${name}=${path}"))
|
|
|
|
|
(lib.concatStringsSep " ")
|
|
|
|
|
(lib.toShellVar "NIX_PATH")
|
|
|
|
|
]
|
|
|
|
|
} cabal test
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
apps.x86_64-linux.checkFmt = mkApp "check-fmt" [ pkgs.nixfmt-tree ] "treefmt --ci";
|
|
|
|
|
|
|
|
|
|
apps.x86_64-linux.fmt = mkApp "fmt" [ pkgs.nixfmt-tree ] "treefmt";
|
|
|
|
|
|
|
|
|
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
|
|
|
|
buildInputs = testDependencies ++ [
|
2025-09-27 21:48:39 -07:00
|
|
|
haskellPackages.haskell-language-server
|
2025-09-11 07:31:48 -07:00
|
|
|
pkgs.ghcid
|
|
|
|
|
pkgs.hpack
|
|
|
|
|
];
|
|
|
|
|
};
|
2025-08-19 00:08:44 -07:00
|
|
|
};
|
2025-07-17 20:25:17 -07:00
|
|
|
}
|