This repository was archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhaskell.nix
49 lines (43 loc) · 1.79 KB
/
haskell.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
{ haskellOverridePath, haskellPackageSets, compiler }:
let release = rec {
makeEnv = wantHoogle: super: k:
let self = super.pkgs;
ghc = self.haskell.packages."${compiler}";
in (if wantHoogle then ghc.ghcWithHoogle else ghc.ghcWithPackages) k;
packageOverrides = pkgs: rec {
haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // {
${compiler} =
let
generatedOverrides = hsNew: hsOld:
let
toPackage = file: _: {
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
value = hsNew.callPackage (haskellOverridePath + "/${file}") { };
};
in pkgs.lib.mapAttrs' toPackage (builtins.readDir haskellOverridePath);
makeOverrides = fn: names: hsNew: hsOld:
let
toPackage = name: {
inherit name;
value = fn hsOld.${name};
};
in builtins.listToAttrs (map toPackage names);
composeExtensionsList =
pkgs.lib.fold pkgs.lib.composeExtensions (_: _: {});
in
pkgs.haskell.packages.${compiler}.override {
overrides = composeExtensionsList [
generatedOverrides
(makeOverrides pkgs.haskell.lib.dontCheck haskellPackageSets.skipTests)
(makeOverrides pkgs.haskell.lib.doJailbreak haskellPackageSets.jailbreak)
(makeOverrides pkgs.haskell.lib.dontHaddock haskellPackageSets.skipHaddock)
(makeOverrides pkgs.haskell.lib.justStaticExecutables haskellPackageSets.justStaticExecutables)
haskellPackageSets.manualOverrides
];
};
};
};
};
};
in release