-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
65 lines (64 loc) · 2.07 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
{
outputs =
{ self, nixpkgs }:
let
projectName = "mail-notifier";
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = { };
overlays = [ self.overlays.default ];
};
inherit (pkgs) haskellPackages;
in
{
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
overlays.default = final: prev: {
haskellPackages = prev.haskellPackages.override (args: {
overrides = final.lib.composeExtensions args.overrides (
let
hlib = final.haskell.lib.compose;
in
hfinal: hprev: {
${projectName} =
let
# filter out haskell-unrelated files to avoid unnecessary rebuilds
src = builtins.path {
path = ./.;
# NOTE setting name is important because the default one contains
# the store path of this flake, which defeats the motivation
name = "source";
filter =
path: type:
!builtins.elem (builtins.baseNameOf path) [
"flake.nix"
"flake.lock"
".envrc"
];
};
in
hfinal.callCabal2nix projectName src { };
}
);
});
};
packages.${system}.default = haskellPackages.generateOptparseApplicativeCompletions [
"mail-notifier"
] (pkgs.haskell.lib.compose.enableSeparateBinOutput haskellPackages.${projectName});
devShells.${system}.default = haskellPackages.shellFor {
packages = hpkgs: [ hpkgs.${projectName} ];
nativeBuildInputs =
(with haskellPackages; [
cabal-install
cabal-fmt
ghcid
haskell-language-server
])
++ (with pkgs; [
nixfmt-rfc-style
]);
withHoogle = true;
doBenchmark = true;
};
};
}