Commit 571a07d7 authored by sternenseemann's avatar sternenseemann
Browse files

doc/haskell: don't use lib.recursiveUpdate in overlays

`lib.recursiveUpdate` indiscriminately recurses into all attribute sets,
also into derivations. This means that it is possible that evaluating a
derivation in the final haskell package set can cause something in
`prev.haskell` to be forced by `recursiveUpdate`, potentially causing an
evaluation error that should not happen.

It can be fixed using a well-crafted predicate for
`lib.recursiveUpdateUntil`, but most robust is just explicitly writing
out the desired merging manually.
parent 82ee0694
Loading
Loading
Loading
Loading
+33 −29
Original line number Diff line number Diff line
@@ -1229,12 +1229,14 @@ in
  in

  {
    haskell = lib.recursiveUpdate prev.haskell {
      compiler.${ghcName} = prev.haskell.compiler.${ghcName}.override {
    haskell = prev.haskell // {
      compiler = prev.haskell.compiler // {
        ${ghcName} = prev.haskell.compiler.${ghcName}.override {
          # Unfortunately, the GHC setting is named differently for historical reasons
          enableProfiledLibs = enableProfiling;
        };
      };
    };
  })

  (final: prev:
@@ -1244,8 +1246,9 @@ in
  in

  {
    haskell = lib.recursiveUpdate prev.haskell {
      packages.${ghcName} = prev.haskell.packages.${ghcName}.override {
    haskell = prev.haskell // {
      packages = prev.haskell.packages // {
        ${ghcName} = prev.haskell.packages.${ghcName}.override {
          overrides = hfinal: hprev: {
            mkDerivation = args: hprev.mkDerivation (args // {
              # Since we are forcing our ideas upon mkDerivation, this change will
@@ -1272,6 +1275,7 @@ in
          };
        };
      };
    };
  })
]
```