/
default.nix
49 lines (45 loc) · 1.67 KB
/
default.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
{ system ? builtins.currentSystem
, crossSystem ? null
, config ? {}
, sourcesOverride ? {}
, gitrev ? null, customConfig ? {}
}:
let
sources = import ./sources.nix { inherit pkgs; }
// sourcesOverride;
iohkNixMain = import sources.iohk-nix {};
haskellNix = (import sources."haskell.nix" { inherit system sourcesOverride; }).nixpkgsArgs;
# use our own nixpkgs if it exists in our sources,
# otherwise use iohkNix default nixpkgs.
nixpkgs = if (sources ? nixpkgs)
then (builtins.trace "Not using IOHK default nixpkgs (use 'niv drop nixpkgs' to use default for better sharing)"
sources.nixpkgs)
else (builtins.trace "Using IOHK default nixpkgs"
iohkNixMain.nixpkgs);
# for inclusion in pkgs:
overlays =
# Haskell.nix (https://github.com/input-output-hk/haskell.nix)
haskellNix.overlays
# haskell-nix.haskellLib.extra: some useful extra utility functions for haskell.nix
++ iohkNixMain.overlays.haskell-nix-extra
++ iohkNixMain.overlays.crypto
# iohkNix: nix utilities and niv:
++ iohkNixMain.overlays.iohkNix
# our own overlays:
++ [
(pkgs: _: with pkgs; rec {
inherit gitrev;
# commonLib: mix pkgs.lib with iohk-nix utils and our own:
commonLib = lib // iohkNix // iohkNix.cardanoLib
// import ./util.nix { inherit haskell-nix; }
# also expose our sources, nixpkgs and overlays
// { inherit overlays sources nixpkgs; };
})
# And, of course, our haskell-nix-ified cabal project:
(import ./pkgs.nix { inherit sources; })
];
pkgs = import nixpkgs {
inherit system crossSystem overlays;
config = haskellNix.config // config;
};
in pkgs