diff options
author | sternenseemann <sternenseemann@systemli.org> | 2024-01-31 19:14:24 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2024-01-31 23:49:32 +0100 |
commit | 571a07d7745a7d69f8d611d0d57ca08d2f3c9d69 (patch) | |
tree | 70c73866ccfe2835bfdcd2618d41821ebf70d9e1 /doc/languages-frameworks | |
parent | 82ee069492ce894f02a2c6a9df42986269b428b9 (diff) |
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.
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r-- | doc/languages-frameworks/haskell.section.md | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md index 0edf0b6f019f1..bec72cb3c0d39 100644 --- a/doc/languages-frameworks/haskell.section.md +++ b/doc/languages-frameworks/haskell.section.md @@ -1229,10 +1229,12 @@ in in { - haskell = lib.recursiveUpdate prev.haskell { - compiler.${ghcName} = prev.haskell.compiler.${ghcName}.override { - # Unfortunately, the GHC setting is named differently for historical reasons - enableProfiledLibs = enableProfiling; + 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; + }; }; }; }) @@ -1244,31 +1246,33 @@ in in { - haskell = lib.recursiveUpdate 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 - # affect every package in the package set. - enableLibraryProfiling = enableProfiling; - - # To actually use profiling on an executable, executable profiling - # needs to be enabled for the executable you want to profile. You - # can either do this globally or… - enableExecutableProfiling = enableProfiling; - }); - - # …only for the package that contains an executable you want to profile. - # That saves on unnecessary rebuilds for packages that you only depend - # on for their library, but also contain executables (e.g. pandoc). - my-executable = haskellLib.enableExecutableProfiling hprev.my-executable; - - # If you are disabling profiling to save on build time, but want to - # retain the ability to substitute from the binary cache. Drop the - # override for mkDerivation above and instead have an override like - # this for the specific packages you are building locally and want - # to make cheaper to build. - my-library = haskellLib.disableLibraryProfiling hprev.my-library; + 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 + # affect every package in the package set. + enableLibraryProfiling = enableProfiling; + + # To actually use profiling on an executable, executable profiling + # needs to be enabled for the executable you want to profile. You + # can either do this globally or… + enableExecutableProfiling = enableProfiling; + }); + + # …only for the package that contains an executable you want to profile. + # That saves on unnecessary rebuilds for packages that you only depend + # on for their library, but also contain executables (e.g. pandoc). + my-executable = haskellLib.enableExecutableProfiling hprev.my-executable; + + # If you are disabling profiling to save on build time, but want to + # retain the ability to substitute from the binary cache. Drop the + # override for mkDerivation above and instead have an override like + # this for the specific packages you are building locally and want + # to make cheaper to build. + my-library = haskellLib.disableLibraryProfiling hprev.my-library; + }; }; }; }; |