-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
74 lines (66 loc) · 2.31 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
66
67
68
69
70
71
72
73
74
{
description = "Tool for working with macOS defaults.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devshell.url = "github:numtide/devshell/";
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
flake-utils.url = "github:numtide/flake-utils";
plist-source = { url = "github:malob/plist/monadfail"; flake = false; };
devshell.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, devshell, nixpkgs, flake-utils, plist-source, ... }:
let
inherit (import ./constants.nix) name ghcVersions defaultGhcVersion;
in
{
overlays.${name} = final: prev: {
haskell = prev.haskell // {
packageOverrides = final.lib.composeExtensions
prev.haskell.packageOverrides
(hfinal: hprev: {
plist = final.haskell.lib.markUnbroken (final.haskell.lib.overrideSrc hprev.plist {
src = plist-source;
});
${name} = hfinal.generateOptparseApplicativeCompletions
[ name ]
(hfinal.callCabal2nix name ./. { });
});
};
${name} = final.haskell.packages.${defaultGhcVersion}.${name};
};
} // flake-utils.lib.eachSystem [ "x86_64-darwin" "aarch64-darwin" ] (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.${name} ]; };
in
{
packages = {
default = pkgs.${name};
${name} = pkgs.${name};
# Create package for all `ghcVersions`.
} // builtins.listToAttrs (map
(v: { name = "${name}-${v}"; value = pkgs.haskell.packages.${v}.${name}; })
ghcVersions
);
devShells.default = devshell.legacyPackages.${system}.mkShell {
inherit name;
packages = builtins.attrValues {
inherit (pkgs.haskell.packages.${defaultGhcVersion})
haskell-language-server
hlint
implicit-hie
weeder
;
inherit (pkgs) stack;
};
commands = [
{
help = "Regenerate hie.yaml (run from project root)";
name = "hie";
category = "project";
command = "gen-hie > hie.yaml";
}
];
};
}
);
}