haskell.compiler.*.ghc.hadrian:only jailbreak directory if necessary

This commit is contained in:
sternenseemann
2025-08-12 14:33:01 +02:00
parent 26dc439eb4
commit 09d584eab5
2 changed files with 17 additions and 6 deletions
@@ -1,4 +1,4 @@
# See also ./make-hadria.nix
# See also ./make-hadrian.nix
{
mkDerivation,
base,
@@ -24,6 +24,8 @@
# GHC source tree to build hadrian from
ghcSrc,
ghcVersion,
# GHC we are using to bootstrap hadrian (stage0)
bootGhcVersion,
# Customization
userSettings ? null,
}:
@@ -48,12 +50,19 @@ mkDerivation {
"-O0"
];
jailbreak =
# Ignore lower bound on directory. Upstream uses this to avoid a race condition
# Ignore bound directory >= 1.3.9.0, unless the bootstrapping GHC ships it
# which is the case for >= 9.12. Upstream uses this to avoid a race condition
# that only seems to affect Windows. We never build GHC natively on Windows.
# https://gitlab.haskell.org/ghc/ghc/-/issues/24382
# https://gitlab.haskell.org/ghc/ghc/-/commit/a2c033cf82635c83f3107706634bebee43297b99
(lib.versionAtLeast ghcVersion "9.6.7" && lib.versionOlder ghcVersion "9.7")
|| lib.versionAtLeast ghcVersion "9.12";
# See also https://gitlab.haskell.org/ghc/ghc/-/issues/24382,
# https://gitlab.haskell.org/ghc/ghc/-/commit/a2c033cf826,
# https://gitlab.haskell.org/ghc/ghc/-/commit/7890f2d8526…
(
lib.versionOlder bootGhcVersion "9.12"
&& (
(lib.versionAtLeast ghcVersion "9.6.7" && lib.versionOlder ghcVersion "9.7")
|| lib.versionAtLeast ghcVersion "9.11"
)
);
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
@@ -55,6 +55,8 @@ in
callPackage' ./hadrian.nix (
{
inherit userSettings;
# Taking `ghc` as an input may be too confusing
bootGhcVersion = bootPkgs.ghc.version;
}
// lib.optionalAttrs (lib.versionAtLeast ghcVersion "9.9") {
# Starting with GHC 9.9 development, additional in tree packages are required