-
Notifications
You must be signed in to change notification settings - Fork 73
/
flake.nix
57 lines (45 loc) · 1.57 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
description = "Higher-order, low-boilerplate free monads.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {nixpkgs, flake-utils, ...}:
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
with nixpkgs.lib;
let
hsPkgs = nixpkgs: compiler: import ./nix/overlay.nix { inherit system nixpkgs compiler; };
ghcs = {
"90" = hsPkgs nixpkgs "ghc90";
"92" = hsPkgs nixpkgs "ghc92";
"94" = hsPkgs nixpkgs "ghc94";
"96" = hsPkgs nixpkgs "ghc96";
"98" = hsPkgs nixpkgs "ghc98";
"910" = hsPkgs nixpkgs "ghc910";
};
default = "96";
mkPackages = version: {
"polysemy-${version}" = ghcs.${version}.polysemy;
"polysemy-plugin-${version}" = ghcs.${version}.polysemy-plugin;
};
defaultPackages = {
inherit (ghcs.${default}) polysemy polysemy-plugin;
default = ghcs.${default}.polysemy;
};
packages = foldl' (l: r: l // r) defaultPackages (map mkPackages (attrNames ghcs));
mkDevShell = name: ghc: ghc.shellFor {
packages = p: [p.polysemy p.polysemy-plugin];
buildInputs = with ghc; [
cabal-install
] ++ nixpkgs.lib.optionals (name != "910" && name != "98" && name != "90") [
(ghc.pkgs.haskell.lib.dontCheck ghcid)
haskell-language-server
];
};
devShells = mapAttrs' (n: g: nameValuePair "ghc${n}" (mkDevShell n g)) ghcs;
in {
inherit packages;
devShells = devShells // { default = devShells."ghc${default}"; };
checks = packages;
});
}