Skip to content

Commit 03e85e0

Browse files
hamishmackrvem
andauthored
Bump nixpkgs pins (input-output-hk#1994)
* Bump nixpkgs pins * ifdLevel 1 * Fix issue using nixpkgs GHC 9.6 * ifdLevel 0 * Update pins * Fix for darwin failures * ifdLevel 1 * Fix ghcjs 8.10 * Bump nixpkgs pins * Update bootstrap GHC versions * Fix for macOS * Fix for macOS * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Fix for ghcjs * Fix mfcgthreads issue * Try removing LD_LIBRARY_PATH * Keep LD_LIBRARY_PATH hack. Use musl git * Add materialization of spdx-3.21 * ifdLevel 0 * Bump nixpkgs pins * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Add 'preInstall' hook for GHC on darwin Problem: Since 9.2.3 'xattr' is used during GHC 'make install' on darwin. This introduces the same issue that was previously fixed for 'buildPhase'. Solution: Add optional 'preInstall' attribuite that sets 'XATTR' to a non-existing path which will skip the 'xattr' invocations during 'make install'. Also explicitly call 'preInstall' hook during 'installPhase'. Fixes input-output-hk#2008. * ifdLevel 0 * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 --------- Co-authored-by: Roman Melnikov <[email protected]>
1 parent 4c516b8 commit 03e85e0

File tree

10 files changed

+7087
-32
lines changed

10 files changed

+7087
-32
lines changed

builder/comp-builder.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,12 @@ let
417417

418418
prePatch =
419419
# emcc is very slow if it cannot cache stuff in $HOME
420+
# Newer nixpkgs default the cache dir to nix store path.
421+
# This seems to cause problems as it is not writeable.
422+
# Setting EM_CACHE explicitly avoids this problem.
420423
(lib.optionalString stdenv.hostPlatform.isGhcjs ''
421424
export HOME=$(mktemp -d)
425+
export EM_CACHE=$(mktemp -d)
422426
'') +
423427
(lib.optionalString (!canCleanSource) ''
424428
echo "Cleaning component source not supported, leaving it un-cleaned"
@@ -603,7 +607,10 @@ let
603607
for p in ${lib.concatStringsSep " " ([ libffi gmp ] ++
604608
# Also include C++ and mcfgthreads DLLs for GHC 9.4.1 and newer
605609
lib.optionals (builtins.compareVersions defaults.ghc.version "9.4.1" >= 0)
606-
[ buildPackages.gcc-unwrapped windows.mcfgthreads ])}; do
610+
[ buildPackages.gcc-unwrapped
611+
# Find the versions of mfcgthreads used by stdenv.cc
612+
(pkgs.threadsCrossFor or (x: windows.mfcgthreads) stdenv.cc.version).package
613+
])}; do
607614
find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
608615
done
609616
''

builder/make-config-files.nix

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ let
4848
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
4949
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
5050
ghcCommandCaps = lib.toUpper ghcCommand';
51-
libDir = ghc.libDir or "lib/${ghcCommand}-${ghc.version}";
51+
libDir = ghc.libDir or
52+
# nixpkgs versions of `ghc` do not have a `.libDir`. So this
53+
# default is for them.
54+
("lib/${ghcCommand}-${ghc.version}"
55+
+ lib.optionalString (__compareVersions ghc.version "9.6.1" >= 0) "/lib");
5256
packageCfgDir = "${libDir}/package.conf.d";
5357

5458
libDeps = haskellLib.uniqueWithName (
@@ -81,9 +85,14 @@ let
8185
find $unwrappedGhc/${packageCfgDir} -name $p'*.conf' -exec cp -f {} $configFiles/${packageCfgDir} \;
8286
done
8387
''}
88+
${ # From GHC 9.6 the nixpkgs ghc derviations now use ${pkgroot} in their `.conf` files.
89+
''
90+
sed -i 's|''${pkgroot}/../../../../|/nix/store/|' $configFiles/${packageCfgDir}/*.conf
91+
sed -i 's|''${pkgroot}|${ghc}/${packageCfgDir}/..|' $configFiles/${packageCfgDir}/*.conf
92+
''}
8493
8594
for l in "''${pkgsHostTarget[@]}"; do
86-
if [ -d "$l/${packageCfgDir}" ]; then
95+
if [ -d "$l/${packageCfgDir}" ] && [[ "$l" != "${ghc}" ]]; then
8796
files=("$l/${packageCfgDir}/"*.conf)
8897
if (( ''${#files[@]} )); then
8998
cp -f "''${files[@]}" $configFiles/${packageCfgDir}

compiler/ghc/default.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ let
202202
"--enable-dwarf-unwind"
203203
"--with-libdw-includes=${lib.getDev elfutils}/include"
204204
"--with-libdw-libraries=${lib.getLib elfutils}/lib"
205+
] ++ lib.optionals (targetPlatform.isDarwin && builtins.compareVersions ghc-version "9.6" >= 0) [
206+
# From https://github.com/NixOS/nixpkgs/commit/6454fb1bc0b5884d0c11c98a8a99735ef5a0cae8
207+
# Darwin uses llvm-ar. GHC will try to use `-L` with `ar` when it is `llvm-ar`
208+
# but it doesn’t currently work because Cabal never uses `-L` on Darwin. See:
209+
# https://gitlab.haskell.org/ghc/ghc/-/issues/23188
210+
# https://github.com/haskell/cabal/issues/8882
211+
"fp_cv_prog_ar_supports_dash_l=no"
205212
] ++ lib.optional (targetPlatform.isGhcjs) "--target=javascript-unknown-ghcjs"; # TODO use configurePlatforms once tripple is updated in nixpkgs
206213

207214
# Splicer will pull out correct variations
@@ -722,6 +729,10 @@ stdenv.mkDerivation (rec {
722729
substituteInPlace rts/win32/ThrIOManager.c --replace rts\\OSThreads.h rts/OSThreads.h
723730
fi
724731
'';
732+
# Same hack as 'preBuild'
733+
preInstall = lib.optionalString stdenv.buildPlatform.isDarwin ''
734+
export XATTR=$(mktemp -d)/nothing
735+
'';
725736
} // lib.optionalAttrs useHadrian {
726737
postConfigure = lib.optionalString stdenv.isDarwin ''
727738
substituteInPlace mk/system-cxx-std-lib-1.0.conf \
@@ -774,6 +785,7 @@ stdenv.mkDerivation (rec {
774785
--replace ',("windres command", "/bin/false")' ',("windres command", "${targetCC.bintools.targetPrefix}windres")'
775786
''
776787
else ''
788+
runHook preInstall
777789
${hadrian}/bin/hadrian ${hadrianArgs} binary-dist-dir
778790
cd _build/bindist/ghc-*
779791
./configure --prefix=$out ${lib.concatStringsSep " " configureFlags}

compiler/ghcjs/ghcjs.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ let
6464
dontInstall = true;
6565
buildPhase = ''
6666
export HOME=$TMP
67+
export EM_CACHE=$(mktemp -d)
6768
mkdir $HOME/.cabal
6869
touch $HOME/.cabal/config
6970
cd lib/boot

flake.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/pkgconf-nixpkgs-map.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ pkgs:
14051405
"libbeidpkcs11" = [ "eid-mw" ];
14061406
"eigen3" = [ "eigen" ];
14071407
"eigen2" = [ "eigen2" ];
1408-
"plannercore" = [ "elementary-planner" ];
1408+
# "plannercore" = [ "elementary-planner" ];
14091409
# "libbitcoinconsensus" = [ "elements" ];
14101410
# "libbitcoinconsensus" = [ "elementsd" ];
14111411
"libdw" = [ "elfutils" ];
@@ -2927,7 +2927,7 @@ pkgs:
29272927
"modsecurity" = [ "libmodsecurity" ];
29282928
"libmodule" = [ "libmodule" ];
29292929
"modulemd-2.0" = [ "libmodulemd" ];
2930-
"libmongo-client" = [ "libmongo-client" ];
2930+
# "libmongo-client" = [ "libmongo-client" ];
29312931
"libmowgli-2" = [ "libmowgli" ];
29322932
"libmp3splt" = [ "libmp3splt" ];
29332933
"mpack" = [ "libmpack" ];
@@ -4466,7 +4466,7 @@ pkgs:
44664466
"r_util" = [ "radare2" ];
44674467
"raft" = [ "raft-canonical" ];
44684468
"RapidJSON" = [ "rapidjson" ];
4469-
"rarian" = [ "rarian" ];
4469+
# "rarian" = [ "rarian" ];
44704470
"raul-1" = [ "raul" ];
44714471
"rav1e" = [ "rav1e" ];
44724472
"raylib" = [ "raylib" ];

lib/system-nixpkgs-map.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ with pkgs;
99
let
1010
# On windows systems we need these to be propagatedBuildInputs so that the DLLs will be found.
1111
gcclibs = if pkgs.stdenv.hostPlatform.isWindows then [
12-
pkgs.windows.mcfgthreads
12+
# Find the versions of mfcgthreads used by stdenv.cc
13+
(pkgs.threadsCrossFor or (x: pkgs.windows.mfcgthreads) pkgs.stdenv.cc.version).package
1314
# If we just use `pkgs.buildPackages.gcc.cc` here it breaks the `th-dlls` test. TODO figure out why exactly.
1415
(pkgs.buildPackages.runCommand "gcc-only" { nativeBuildInputs = [ pkgs.buildPackages.xorg.lndir ]; } ''
1516
mkdir $out

0 commit comments

Comments
 (0)