3
0
Fork 0
forked from mirrors/nixpkgs

haskell: allow overriding all package sets at once

Setting haskell.packageOverrides like so:

  haskell = super.haskell // {
    packageOverrides = self: super: {
      my-package = ...;
      my-other-package = ...;
    };
  };

causes all compiler-specific package sets to be overridden with those
overrides.
This commit is contained in:
Bas van Dijk 2018-04-21 19:37:49 +02:00
parent 3d1976b083
commit bf6d796a27
2 changed files with 57 additions and 1 deletions

View file

@ -666,6 +666,56 @@ prefer one built with GHC 7.8.x in the first place. However, for users who
cannot use GHC 7.10.x at all for some reason, the approach of downgrading to an cannot use GHC 7.10.x at all for some reason, the approach of downgrading to an
older version might be useful. older version might be useful.
### How to override packages in all compiler-specific package sets
In the previous section we learned how to override a package in a single
compiler-specific package set. You may have some overrides defined that you want
to use across multiple package sets. To accomplish this you could use the
technique that we learned in the previous section by repeating the overrides for
all the compiler-specific package sets. For example:
```nix
{
packageOverrides = super: let self = super.pkgs; in
{
haskell = super.haskell // {
packages = super.haskell.packages // {
ghc784 = super.haskell.packages.ghc784.override {
overrides = self: super: {
my-package = ...;
my-other-package = ...;
};
};
ghc822 = super.haskell.packages.ghc784.override {
overrides = self: super: {
my-package = ...;
my-other-package = ...;
};
};
...
};
};
};
}
```
However there's a more convenient way to override all compiler-specific package
sets at once:
```nix
{
packageOverrides = super: let self = super.pkgs; in
{
haskell = super.haskell // {
packageOverrides = self: super: {
my-package = ...;
my-other-package = ...;
};
};
};
}
```
### How to recover from GHC's infamous non-deterministic library ID bug ### How to recover from GHC's infamous non-deterministic library ID bug
GHC and distributed build farms don't get along well: GHC and distributed build farms don't get along well:

View file

@ -19,7 +19,10 @@ let
inherit pkgs; inherit pkgs;
}; };
callPackage = newScope { inherit haskellLib; }; callPackage = newScope {
inherit haskellLib;
overrides = pkgs.haskell.packageOverrides;
};
bootstrapPackageSet = self: super: { bootstrapPackageSet = self: super: {
mkDerivation = drv: super.mkDerivation (drv // { mkDerivation = drv: super.mkDerivation (drv // {
@ -99,6 +102,9 @@ in rec {
(name: compiler."${name}".override { enableIntegerSimple = true; })); (name: compiler."${name}".override { enableIntegerSimple = true; }));
}; };
# Default overrides that are applied to all package sets.
packageOverrides = self : super : {};
# Always get compilers from `buildPackages` # Always get compilers from `buildPackages`
packages = let bh = buildPackages.haskell; in { packages = let bh = buildPackages.haskell; in {