-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
63 lines (52 loc) · 1.68 KB
/
default.nix
File metadata and controls
63 lines (52 loc) · 1.68 KB
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
{ system ? builtins.currentSystem
, inputs ? {}
, pkgs ?
if inputs ? nixpkgs
then import inputs.nixpkgs { inherit system; }
else import ./pins/nixpkgs { inherit system; }
}:
with pkgs.lib;
module:
let eval = import ./eval.nix { inherit system pkgs inputs; };
evaluated = eval module;
config = evaluated.config;
options = evaluated.options;
docs = import ./docs.nix { inherit pkgs options; };
haskell-nix =
let mkProject = x:
let xs = toList x;
evaled = eval xs;
proj = evaled.config.haskell-nix.project;
in {
config = evaled.config;
override = y:
let ys = toList y;
in mkProject (xs ++ ys);
} // proj;
in rec {
project = mkProject module;
ghcWithPackages = m: packages:
let ms = toList m;
syntheticSrc = pkgs.writeTextFile {
name = "ghc-with-packages-src";
destination = "/ghc-with-packages.cabal";
text = ''
cabal-version: 2.4
name: ghc-with-packages
version: 0
'';
};
proj = mkProject ([{
name = "ghc-with-packages";
src = syntheticSrc;
cabalProject = ''
extra-packages: ${builtins.concatStringsSep ", " packages}
'';
}] ++ ms);
in proj.ghcWithPackages (ps: map (n: ps.${n}) packages);
};
in {
inherit config haskell-nix;
nixpkgs = config.importing.nixpkgs;
manual = docs;
} // mapAttrs (_: value: { haskell-nix = value; }) haskell-nix