mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
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.
This commit is contained in:
parent
82ee069492
commit
571a07d774
1 changed files with 30 additions and 26 deletions
|
@ -1229,10 +1229,12 @@ in
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
haskell = lib.recursiveUpdate prev.haskell {
|
haskell = prev.haskell // {
|
||||||
compiler.${ghcName} = prev.haskell.compiler.${ghcName}.override {
|
compiler = prev.haskell.compiler // {
|
||||||
# Unfortunately, the GHC setting is named differently for historical reasons
|
${ghcName} = prev.haskell.compiler.${ghcName}.override {
|
||||||
enableProfiledLibs = enableProfiling;
|
# Unfortunately, the GHC setting is named differently for historical reasons
|
||||||
|
enableProfiledLibs = enableProfiling;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -1244,31 +1246,33 @@ in
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
haskell = lib.recursiveUpdate prev.haskell {
|
haskell = prev.haskell // {
|
||||||
packages.${ghcName} = prev.haskell.packages.${ghcName}.override {
|
packages = prev.haskell.packages // {
|
||||||
overrides = hfinal: hprev: {
|
${ghcName} = prev.haskell.packages.${ghcName}.override {
|
||||||
mkDerivation = args: hprev.mkDerivation (args // {
|
overrides = hfinal: hprev: {
|
||||||
# Since we are forcing our ideas upon mkDerivation, this change will
|
mkDerivation = args: hprev.mkDerivation (args // {
|
||||||
# affect every package in the package set.
|
# Since we are forcing our ideas upon mkDerivation, this change will
|
||||||
enableLibraryProfiling = enableProfiling;
|
# affect every package in the package set.
|
||||||
|
enableLibraryProfiling = enableProfiling;
|
||||||
|
|
||||||
# To actually use profiling on an executable, executable profiling
|
# To actually use profiling on an executable, executable profiling
|
||||||
# needs to be enabled for the executable you want to profile. You
|
# needs to be enabled for the executable you want to profile. You
|
||||||
# can either do this globally or…
|
# can either do this globally or…
|
||||||
enableExecutableProfiling = enableProfiling;
|
enableExecutableProfiling = enableProfiling;
|
||||||
});
|
});
|
||||||
|
|
||||||
# …only for the package that contains an executable you want to profile.
|
# …only for the package that contains an executable you want to profile.
|
||||||
# That saves on unnecessary rebuilds for packages that you only depend
|
# That saves on unnecessary rebuilds for packages that you only depend
|
||||||
# on for their library, but also contain executables (e.g. pandoc).
|
# on for their library, but also contain executables (e.g. pandoc).
|
||||||
my-executable = haskellLib.enableExecutableProfiling hprev.my-executable;
|
my-executable = haskellLib.enableExecutableProfiling hprev.my-executable;
|
||||||
|
|
||||||
# If you are disabling profiling to save on build time, but want to
|
# If you are disabling profiling to save on build time, but want to
|
||||||
# retain the ability to substitute from the binary cache. Drop the
|
# retain the ability to substitute from the binary cache. Drop the
|
||||||
# override for mkDerivation above and instead have an override like
|
# override for mkDerivation above and instead have an override like
|
||||||
# this for the specific packages you are building locally and want
|
# this for the specific packages you are building locally and want
|
||||||
# to make cheaper to build.
|
# to make cheaper to build.
|
||||||
my-library = haskellLib.disableLibraryProfiling hprev.my-library;
|
my-library = haskellLib.disableLibraryProfiling hprev.my-library;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue