-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
75 lines (71 loc) · 2.3 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
{
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/22.05;
utils.url = github:numtide/flake-utils;
};
outputs = inputs@{ nixpkgs, utils, ... }:
utils.lib.eachDefaultSystem (system:
let nixpkgs' = import nixpkgs {
inherit system;
};
unwords = nixpkgs'.lib.concatStringsSep " ";
options = [
"-Wall"
"-Wcompat"
"-Wincomplete-uni-patterns"
"-Wredundant-constraints"
# "-Wmissing-export-lists"
"-Wincomplete-record-updates"
"-Wmissing-deriving-strategies"
];
extensions = [
"-XDerivingStrategies"
];
this = ghcVersion:
let pkgs = nixpkgs'.haskell.packages.${ghcVersion}.override {
overrides = (import ./nix/dependencies.nix inputs ghcVersion);
};
vcache = pkgs.mkDerivation {
pname = "vcache";
version = "0.2.7";
src = ./.;
isLibrary = true;
libraryHaskellDepends = with pkgs; [
direct-murmur-hash
bytestring
transformers
containers
stm
lmdb
filelock
easy-file
random
];
license = nixpkgs.lib.licenses.gpl3Plus;
passthru = { inherit pkgs; };
};
ghcWithPackages = nixpkgs'.lib.removeSuffix "\n" (builtins.readFile vcache.env);
ghci = nixpkgs'.writeScript "ghci"
''
set -x
${ghcWithPackages}/bin/ghci ${unwords (options ++ extensions)} $(find . -name '*.hs')
'';
in { inherit vcache ghci; };
thisNative = this "ghc922";
in
{
packages.default = thisNative.vcache;
apps =
let binaryToApp = bin: { type = "app"; program = "${bin}/bin/${bin.pname}"; };
in
{
ghci = {
type = "app";
program = thisNative.ghci.outPath;
};
};
devShells = {
default = thisNative.vcache.env;
};
});
}