-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
81 lines (72 loc) · 2.58 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
75
76
77
78
79
80
81
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
hvm.url = "github:hhefesto/HVM";
};
outputs = inputs@{ self, nixpkgs, flake-utils, flake-compat, hvm, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
imports = [];
perSystem = { self', system, ... }:
let pkgs = import nixpkgs { inherit system; };
t = pkgs.lib.trivial;
hl = pkgs.haskell.lib;
compiler = pkgs.haskell.packages."ghc92";
project = runTests: executable-name: devTools: # [1]
let addBuildTools = (t.flip hl.addBuildTools) devTools;
addBuildDepends = (t.flip hl.addBuildDepends)
[ hvm.defaultPackage.${system} ];
doRunTests =
if runTests then hl.doCheck else hl.dontCheck;
in compiler.developPackage {
root = pkgs.lib.sourceFilesBySuffices ./.
[ ".cabal"
".hs"
".tel"
"cases"
"LICENSE"
];
name = executable-name;
returnShellEnv = !(devTools == [ ]); # [2]
modifier = (t.flip t.pipe) [
addBuildDepends
addBuildTools
doRunTests
# hl.dontHaddock
];
overrides = self: super: {
sbv = pkgs.haskell.lib.compose.markUnbroken (pkgs.haskell.lib.dontCheck super.sbv);
};
# uncomment for profiling:
# cabal2nixOptions = "--enable-profiling --benchmark";
};
in {
packages.telomare = project false "telomare" [ ]; # [3]
packages.default = self.packages.${system}.telomare;
apps.default = {
type = "app";
program = self.packages.${system}.telomare + "/bin/telomare";
};
apps.repl = {
type = "app";
program = self.packages.${system}.telomare + "/bin/telomare-repl";
};
devShells.default = project true "telomare-with-tools" (with compiler; [ # [4]
cabal-install
haskell-language-server
hlint
ghcid
stylish-haskell
hvm.defaultPackage.${system}
]);
checks = {
build-and-tests = project true "telomare-with-tests" [ ];
};
};
};
}