-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathdefault.nix
50 lines (47 loc) · 1.69 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
50
let haskellNix = {
checkMaterialization ? false, # Allows us to easily switch on materialization checking
defaultCompilerNixName ? null, # Quick way to override the default compiler e.g. "ghc883"
system ? builtins.currentSystem,
... }: rec {
sources = {
inherit (import ./nixpkgs/default.nix) nixpkgs-1909 nixpkgs-2003 nixpkgs-default;
};
config = import ./config.nix;
overlays = [ allOverlays.combined ] ++ (
if checkMaterialization == true
then [(
final: prev: {
haskell-nix = prev.haskell-nix // {
checkMaterialization = true;
};
}
)]
else []
) ++ (
if defaultCompilerNixName != null
then [(
final: prev: {
haskell-nix = prev.haskell-nix // {
inherit defaultCompilerNixName;
};
}
)]
else []
);
allOverlays = import ./overlays;
nixpkgsArgs = { inherit config overlays system; };
pkgs = import sources.nixpkgs-default nixpkgsArgs;
};
haskellNixV1 = (haskellNix {}).nixpkgsArgs;
haskellNixV2 = haskellNix;
v1DeprecationMessage = "Version 1 is deprecated: use version 2 (nixpkgs arguments are available as the `nixpkgsArgs` attribute of version 2)";
# If no arguments, then you get V1
# I'd like to make importing directly issue a warning, but I couldn't figure out a way to make it happen
in haskellNixV1 // {
__functor = _: { version ? 2, ... }@args:
if version == 1
then builtins.trace v1DeprecationMessage haskellNixV1
else if version == 2
then haskellNixV2 args
else builtins.throw ("haskell.nix: unknown version: " + (builtins.toString version));
}