Skip to content

Commit e491253

Browse files
authored
Bump nixpkgs pins (input-output-hk#1930)
Update the nixpkgs pins to keep them up to date and to help catch issues that arise when using newer versions. This PR includes fixes and work arounds for a number that came up when nixpkgs was updated: * GHC 9.6.1 is now included in nixpkgs, but the package database locations and formats are different enough that compiling tools with it does not work. The work around is not to use this version of GHC from nixpkgs for now. * Autoreconf now has a newer `config.sub` and this broke a couple of things. It overwrote the version used for GHC 9.6.1 (which included ghcjs) and it broke the library patches in ghcjs 8.10.7. * We included a work around for a openssl windows cross compilation issue (also fixed it upstream NixOS/nixpkgs#229465). * -optc-mno-outline-atomics was added for lGHC builds targeting aarch64 linux that now use ghc 12
1 parent e552efe commit e491253

File tree

7 files changed

+52
-28
lines changed

7 files changed

+52
-28
lines changed

builder/comp-builder.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ let
200200
++ lib.optional stdenv.hostPlatform.isLinux (enableFeature enableDeadCodeElimination "split-sections")
201201
++ lib.optionals haskellLib.isCrossHost (
202202
map (arg: "--hsc2hs-option=" + arg) (["--cross-compile"] ++ lib.optionals (stdenv.hostPlatform.isWindows) ["--via-asm"])
203-
++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )
203+
++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${
204+
# Older ghcjs patched config.sub to support "js-unknown-ghcjs" (not "javascript-unknown-ghcjs")
205+
if stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9" < 0
206+
then "js-unknown-ghcjs"
207+
else stdenv.hostPlatform.config}" )
204208
++ configureFlags
205209
++ (ghc.extraConfigureFlags or [])
206210
++ lib.optional enableDebugRTS "--ghc-option=-debug"

compiler/ghc/default.nix

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,20 @@ let
275275
+ lib.optionalString useLLVM "+llvm"
276276
+ lib.optionalString enableDWARF "+debug_info"
277277
+ lib.optionalString targetPlatform.isGhcjs "+native_bignum+no_profiled_libs"
278-
} --docs=no-sphinx -j --verbose";
278+
} --docs=no-sphinx -j --verbose"
279+
# This is needed to prevent $GCC from emitting out of line atomics.
280+
# Those would then result in __aarch64_ldadd1_sync and others being referenced, which
281+
# we don't handle in the RTS properly yet. Until we figure out how to _properly_ deal
282+
# with the RTS_SYMBOLS in GHC, we are better off disableing the out of line atomics.
283+
+ lib.optionalString ( hostPlatform.isAarch64 && targetPlatform.isLinux && targetPlatform.isAarch64)
284+
" '*.*.ghc.c.opts += -optc-mno-outline-atomics'"
285+
# For cross compilers only the RTS should be built with -mno-outline-atomics
286+
+ lib.optionalString (!hostPlatform.isAarch64 && targetPlatform.isLinux && targetPlatform.isAarch64)
287+
" '*.rts.ghc.c.opts += -optc-mno-outline-atomics'"
288+
# The following is required if we build on aarch64-darwin for aarch64-iOS. Otherwise older
289+
# iPhones/iPads/... won't understand the compiled code, as the compiler will emit LDSETALH
290+
# + lib.optionalString (targetPlatform.???) "'*.rts.ghc.c.opts += -optc-mcpu=apple-a7 -optc-march=armv8-a+norcpc'"
291+
;
279292

280293
# When installation is done by copying the stage1 output the directory layout
281294
# is different.
@@ -319,7 +332,7 @@ stdenv.mkDerivation (rec {
319332

320333
# configure was run by configured-src already.
321334
phases = [ "unpackPhase" "patchPhase" ]
322-
++ lib.optional (ghc-patches != []) "autoreconfPhase"
335+
++ lib.optional (ghc-patches != [] && !stdenv.targetPlatform.isGhcjs) "autoreconfPhase" # autoreconf can replace config.sub with one that is missing ghcjs
323336
++ [ "configurePhase" "buildPhase"
324337
"checkPhase" "installPhase"
325338
"fixupPhase"

flake.lock

Lines changed: 9 additions & 9 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,10 +2552,10 @@ pkgs:
25522552
"libavc1394" = [ "libavc1394" ];
25532553
"libavif" = [ "libavif" ];
25542554
"ayatana-appindicator3-0.1" = [ "libayatana-appindicator" ];
2555-
"ayatana-appindicator-0.1" = [ "libayatana-appindicator-gtk2" ];
2555+
# "ayatana-appindicator-0.1" = [ "libayatana-appindicator-gtk2" ];
25562556
# "ayatana-appindicator3-0.1" = [ "libayatana-appindicator-gtk3" ];
25572557
"ayatana-indicator3-0.4" = [ "libayatana-indicator" ];
2558-
"ayatana-indicator-0.4" = [ "libayatana-indicator-gtk2" ];
2558+
# "ayatana-indicator-0.4" = [ "libayatana-indicator-gtk2" ];
25592559
# "ayatana-indicator3-0.4" = [ "libayatana-indicator-gtk3" ];
25602560
"libb2" = [ "libb2" ];
25612561
"baseencode" = [ "libbaseencode" ];

overlays/bootstrap.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,10 @@ in {
10331033
cabal-install-tool = {compiler-nix-name, ...}@args:
10341034
(final.haskell-nix.tool compiler-nix-name "cabal" ({pkgs, ...}: {
10351035
evalPackages = pkgs.buildPackages;
1036-
compilerSelection = p: p.haskell-nix.compiler // p.haskell.compiler;
1036+
compilerSelection = p: p.haskell-nix.compiler // p.haskell.compiler
1037+
# Avoid ghc961 from nixpkgs for now as the files in it are not
1038+
# where we expect them.
1039+
// { inherit (p.haskell-nix.compiler) ghc961; };
10371040
version = "3.8.1.0";
10381041
index-state = final.haskell-nix.internalHackageIndexState;
10391042
materialized = ../materialized + "/${compiler-nix-name}/cabal-install";

overlays/ghcjs.nix

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ final: prev:
1313
# Apply the patches that came with `ghcjs`
1414
# Also add a "Keep alive" message to prevent hydra timeouts when hsc2hs runs
1515
packages = pkgs.lib.genAttrs (pkgs.lib.optionals (__elem config.compiler.nix-name ["ghc865" "ghc884" "ghc8107"]) ["base" "directory" "filepath" "ghc-prim" "integer-gmp" "process" "template-haskell" "time" "unix" "Win32" ])
16-
(name: {
16+
(name: let
17+
ghcjs-src = pkgs.buildPackages.haskell-nix.compiler.${config.compiler.nix-name}.project.configured-src;
18+
# This src derivation is needed for the unpatched config.sub file
19+
# (the config.sub in the hackage is too old and the one created by autoreconf is too new for the patch).
20+
ghcjs-src' = pkgs.buildPackages.haskell-nix.compiler.${config.compiler.nix-name}.configured-src;
21+
in {
1722
components.library.preConfigure = ''
1823
tr -d '\r' < ${name}.cabal > ${name}.cabal-new
1924
mv ${name}.cabal-new ${name}.cabal
20-
patch -p3 < ${pkgs.buildPackages.haskell-nix.compiler.${config.compiler.nix-name}.project.configured-src}/lib/patches/${name}.patch
25+
if [[ -e config.sub ]]; then cp ${ghcjs-src'}/config.sub config.sub; fi
26+
patch -p3 < ${ghcjs-src}/lib/patches/${name}.patch
2127
'';
2228
components.library.preBuild = ''
2329
# Avoid timeouts while unix package runs hsc2hs (it does not print anything

overlays/windows.nix

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
# and not end up with the expected changes we want.
55
final: prev:
66
{
7-
# on windows we have this habit of putting libraries
8-
# into `bin`, whereas on unix it's usually `lib`. For
9-
# this confuses nix easily. So we'll just move the
10-
# .dll's from `bin` into `$out/lib`. Such that they
11-
# are trivially found.
12-
# openssl = prev.openssl.overrideAttrs (drv: {
13-
# # postInstall = with prev.stdenv; drv.postInstall + lib.optionalString hostPlatform.isWindows ''
14-
# # cp $bin/bin/*.dll $out/lib/
15-
# # '';
16-
# postFixup = "";
17-
# });
7+
# Work around for https://github.com/NixOS/nixpkgs/pull/229465
8+
openssl = if !prev.stdenv.hostPlatform.isWindows then prev.openssl else prev.openssl.overrideAttrs (drv: {
9+
nativeBuildInputs = final.lib.filter (x: x.name or "" != "make-shell-wrapper-hook") drv.nativeBuildInputs;
10+
postInstall = ''
11+
function makeWrapper () {
12+
echo Skipping makeWrapper
13+
}
14+
'' + drv.postInstall;
15+
});
1816
} // prev.lib.optionalAttrs (prev ? mfpr) {
1917
mfpr = if !prev.stdenv.hostPlatform.isWindows then prev.mpfr else prev.mfpr.overrideAttrs (drv: {
2018
configureFlags = (drv.configureFlags or []) ++ [ "--enable-static --disable-shared" ];

0 commit comments

Comments
 (0)