-
Notifications
You must be signed in to change notification settings - Fork 18
/
flake.nix
54 lines (49 loc) · 1.48 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
{
description = "nvim-hs";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
};
haskellPackages = pkgs.haskellPackages;
t = pkgs.lib.trivial;
hl = pkgs.haskell.lib;
# Parameter buildTools is used to share most of the boilerplate code
# between the package and the devShell.
project = { buildTools ? [ ] }:
let addBuildTools = (t.flip hl.addBuildTools) buildTools;
in
haskellPackages.developPackage {
root = nixpkgs.lib.sourceFilesBySuffices ./. [ ".cabal" ".hs" ];
name = "nvim-hs";
returnShellEnv = !(buildTools == [ ]);
modifier = package: t.pipe package [
addBuildTools
hl.enableStaticLibraries
hl.justStaticExecutables
hl.disableLibraryProfiling
hl.disableExecutableProfiling
];
};
in
{
packages.pkg = project { };
defaultPackage = self.packages.${system}.pkg;
devShell = with haskellPackages; project {
buildTools = [
cabal-fmt
cabal-install
fourmolu
haskell-language-server
hlint
];
};
});
}