-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
65 lines (57 loc) · 1.88 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
58
59
60
61
62
63
64
65
{
description = "Graded Monads with a Qualified Do Interface";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
flake-utils = {
url = github:numtide/flake-utils;
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils }:
let
ghcVersion = "945";
compiler = "ghc${ghcVersion}";
# default systems compatible with pre-commit-hooks.nix
# https://github.com/cachix/pre-commit-hooks.nix/pull/122
defaultSystems = [
"aarch64-linux"
# "aarch64-darwin"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
in
flake-utils.lib.eachSystem defaultSystems (system:
let
pkgs = import nixpkgs { inherit system; };
# need to do the evalPkgs trick so that IFD works with `nix flake check`
# https://github.com/NixOS/nix/issues/4265
evalPkgs = import nixpkgs { system = "x86_64-linux"; };
# Our haskell packages override, needs to use evalPkgs because
# cabal2nix uses IFD
hsPkgs = evalPkgs.haskell.packages.${compiler}.override {
overrides = hfinal: hprev: {
graded-monads = hfinal.callCabal2nix "graded-monads" ./. { };
};
};
in
rec {
# Note: cannot reference anything that depends on `evalPkgs` like `hsPkgs`
# otherwise non-x86_64-linux users will not be able to build the dev env
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
cabal2nix
cabal-install
ghcid
haskell.compiler.${compiler}
haskell.packages.${compiler}.haskell-language-server
ormolu
zlib
];
};
packages = flake-utils.lib.flattenTree {
graded-monads = hsPkgs.graded-monads;
};
defaultPackage = packages.graded-monads;
});
}