diff --git a/builder/comp-builder.nix b/builder/comp-builder.nix index 60bce48716..ea9a1f05bd 100644 --- a/builder/comp-builder.nix +++ b/builder/comp-builder.nix @@ -447,6 +447,10 @@ let (lib.optionalString stdenv.hostPlatform.isGhcjs '' export HOME=$(mktemp -d) export EM_CACHE=$(mktemp -d) + if [ -d ${pkgsBuildBuild.emscripten}/share/emscripten/cache ]; then + cp -r ${pkgsBuildBuild.emscripten}/share/emscripten/cache/* $EM_CACHE/ + chmod +w -R $EM_CACHE + fi '') + (lib.optionalString (!canCleanSource) '' echo "Cleaning component source not supported, leaving it un-cleaned" diff --git a/ci.nix b/ci.nix index 42d3ea0f3d..e07482ba5e 100644 --- a/ci.nix +++ b/ci.nix @@ -18,7 +18,7 @@ # short names for nixpkgs versions nixpkgsVersions = { - "R2411" = inputs.nixpkgs-2411; + "R2505" = inputs.nixpkgs-2505; "unstable" = inputs.nixpkgs-unstable; }; @@ -43,6 +43,14 @@ "libdwarf-20181024" "dwarfdump-20181024" ]; + allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "android-sdk-ndk" + "android-sdk-platform-tools" + "aarch64-unknown-linux-android-ndk-toolchain-wrapper" + "aarch64-unknown-linux-android-ndk-toolchain" + "armv7a-unknown-linux-androideabi-ndk-toolchain-wrapper" + "armv7a-unknown-linux-androideabi-ndk-toolchain" + ]; }; }; @@ -57,7 +65,7 @@ # cabal-install and nix-tools plans. When removing a ghc version # from here (so that is no longer cached) also remove ./materialized/ghcXXX. # Update supported-ghc-versions.md to reflect any changes made here. - nixpkgs.lib.optionalAttrs (nixpkgsName == "R2411") { + nixpkgs.lib.optionalAttrs (builtins.elem nixpkgsName ["R2411" "R2505"]) { ghc96 = true; ghc98 = true; ghc910 = true; @@ -77,11 +85,7 @@ let lib = nixpkgs.lib; in lib.optionalAttrs (nixpkgsName == "unstable" && (__match ".*llvm" compiler-nix-name == null) - && ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) - || (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) - || (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948" "ghc966" "ghc967" "ghc96720250227" "ghc982" "ghc983" "ghc984"]) - || (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948" "ghc966" "ghc967" "ghc96720250227" "ghc982" "ghc983" "ghc984"]) - )) { + && !builtins.elem compiler-nix-name ["ghc9102"]) { inherit (lib.systems.examples) ghcjs; } // lib.optionalAttrs (nixpkgsName == "unstable" && (__match ".*llvm" compiler-nix-name == null) @@ -100,8 +104,10 @@ } // lib.optionalAttrs (__match ".*llvm" compiler-nix-name == null && system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) { # Out llvm versions of GHC seem to break for musl32 inherit (lib.systems.examples) musl32; - } // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "R2411" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) { - inherit (lib.systems.examples) aarch64-android-prebuilt armv7a-android-prebuilt; + } // lib.optionalAttrs (system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) { + inherit (lib.systems.examples) aarch64-android-prebuilt; + } // lib.optionalAttrs (system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948" "ghc91320250523"]) { + inherit (lib.systems.examples) armv7a-android-prebuilt; } // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc8107" "ghc902"]) { # TODO fix this for the compilers we build with hadrian (ghc >=9.4) inherit (lib.systems.examples) aarch64-multiplatform-musl; diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index 4189884671..9d31c197cf 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -422,9 +422,9 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec { export CXX="${targetCC}/bin/em++" export LD="${targetCC}/bin/emcc" '' + ( - # Including AR and RANLIB here breaks tests.js-template-haskell for GHC 9.6 + # Including AR and RANLIB here breaks tests.js-template-haskell for GHC <9.12 # `LLVM ERROR: malformed uleb128, extends past end` - if builtins.compareVersions ghc-version "9.8" >= 0 + if builtins.compareVersions ghc-version "9.12" >= 0 then '' export AR="${targetCC}/bin/emar" export NM="${targetCC}/share/emscripten/emnm" @@ -435,6 +435,10 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec { '' ) + '' export EM_CACHE=$(mktemp -d) + if [ -d ${targetCC}/share/emscripten/cache ]; then + cp -r ${targetCC}/share/emscripten/cache/* $EM_CACHE/ + chmod +w -R $EM_CACHE + fi mv config.sub.ghcjs config.sub '') # GHC is a bit confused on its cross terminology, as these would normally be diff --git a/default.nix b/default.nix index ade481f5cb..c43181eb30 100644 --- a/default.nix +++ b/default.nix @@ -97,6 +97,9 @@ self // { pkgs-2411 = import self.inputs.nixpkgs-2411 (nixpkgsArgs // { localSystem = { inherit system; }; }); + pkgs-2505 = import self.inputs.nixpkgs-2505 (nixpkgsArgs // { + localSystem = { inherit system; }; + }); pkgs-unstable = import self.inputs.nixpkgs-unstable (nixpkgsArgs // { localSystem = { inherit system; }; }); diff --git a/flake.lock b/flake.lock index 6ce56435d5..adb9a3fbc0 100644 --- a/flake.lock +++ b/flake.lock @@ -372,11 +372,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1747047742, - "narHash": "sha256-PCDULyZSIPdDdF8Lanbcy+Dl6AJ5z6H2ng3sRsv+gwc=", + "lastModified": 1749176681, + "narHash": "sha256-RLoo84PBSeGKbqMETsU0lEJDnc/oTx0l/TYzCaWqlgc=", "owner": "stable-haskell", "repo": "iserv-proxy", - "rev": "dea34de4bde325aca22472c18d659bee7800b477", + "rev": "6972fbc49574108cb48723bb94260e3ce17898f7", "type": "github" }, "original": { @@ -436,11 +436,11 @@ }, "nixpkgs-2411": { "locked": { - "lastModified": 1746566971, - "narHash": "sha256-I40weT0FZWth1IEjgR5a0zC9LLyrPwTC0DAQcejtTJE=", + "lastModified": 1748037224, + "narHash": "sha256-92vihpZr6dwEMV6g98M5kHZIttrWahb9iRPBm1atcPk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "209c5b3b0f5cf5b5a7e12ddea59bf19699f97e75", + "rev": "f09dede81861f3a83f7f06641ead34f02f37597f", "type": "github" }, "original": { @@ -450,13 +450,29 @@ "type": "github" } }, + "nixpkgs-2505": { + "locked": { + "lastModified": 1748852332, + "narHash": "sha256-r/wVJWmLYEqvrJKnL48r90Wn9HWX9SHFt6s4LhuTh7k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a8167f3cc2f991dd4d0055746df53dae5fd0c953", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { - "lastModified": 1746576598, - "narHash": "sha256-FshoQvr6Aor5SnORVvh/ZdJ1Sa2U4ZrIMwKBX5k2wu0=", + "lastModified": 1748856973, + "narHash": "sha256-RlTsJUvvr8ErjPBsiwrGbbHYW8XbB/oek0Gi78XdWKg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55", + "rev": "e4b09e47ace7d87de083786b404bf232eb6c89d8", "type": "github" }, "original": { @@ -515,6 +531,7 @@ "nixpkgs-2311": "nixpkgs-2311", "nixpkgs-2405": "nixpkgs-2405", "nixpkgs-2411": "nixpkgs-2411", + "nixpkgs-2505": "nixpkgs-2505", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" diff --git a/flake.nix b/flake.nix index 017d695555..12f31554a9 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ nixpkgs-2311 = { url = "github:NixOS/nixpkgs/nixpkgs-23.11-darwin"; }; nixpkgs-2405 = { url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin"; }; nixpkgs-2411 = { url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin"; }; + nixpkgs-2505 = { url = "github:NixOS/nixpkgs/nixpkgs-25.05-darwin"; }; nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; flake-compat = { url = "github:input-output-hk/flake-compat/hkm/gitlab-fix"; flake = false; }; "hls-1.10" = { url = "github:haskell/haskell-language-server/1.10.0.0"; flake = false; }; diff --git a/lazy-inputs/ghc913/flake.lock b/lazy-inputs/ghc913/flake.lock index 15c5acd8a1..d73af49a22 100644 --- a/lazy-inputs/ghc913/flake.lock +++ b/lazy-inputs/ghc913/flake.lock @@ -3,11 +3,11 @@ "ghc913": { "flake": false, "locked": { - "lastModified": 1735577639, - "narHash": "sha256-sGNckeL3B6Iw+3wawRjgFEXo/dLiyKAtnbFxY9tX6Qg=", + "lastModified": 1748027596, + "narHash": "sha256-5WU40R26lwl0lRTkEnWui8CEikZ9gRnbiOa4aw/GbI4=", "ref": "refs/heads/master", - "rev": "278a53ee698d961d97afb60be9db2d8bf60b4074", - "revCount": 67713, + "rev": "17db44c5b32fff82ea988fa4f1a233d1a27bdf57", + "revCount": 68114, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" diff --git a/lib/supported-languages.nix b/lib/supported-languages.nix index ee5ba8f194..0e459c0505 100644 --- a/lib/supported-languages.nix +++ b/lib/supported-languages.nix @@ -312,5 +312,11 @@ evalPackages.writeTextFile { NoMultilineStrings NamedDefaults NoNamedDefaults + '' + + pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.13" >=0) '' + ExplicitLevelImports + ImplicitStagePersistence + NoExplicitLevelImports + NoImplicitStagePersistence ''}''; } diff --git a/modules/component-options.nix b/modules/component-options.nix index 4900e9d8d2..3fbc3cf803 100644 --- a/modules/component-options.nix +++ b/modules/component-options.nix @@ -1,4 +1,4 @@ -{ lib, haskellLib, ... }: +{ pkgs, lib, haskellLib, ... }: { options = { buildable = lib.mkOption { @@ -104,7 +104,8 @@ enableStatic = lib.mkOption { description = "If set, enables building static libraries and executables."; type = lib.types.bool; - default = true; + # Disabled for ghcjs, see https://gitlab.haskell.org/ghc/ghc/-/issues/23235 + default = !pkgs.stdenv.hostPlatform.isGhcjs; }; enableShared = lib.mkOption { diff --git a/modules/package.nix b/modules/package.nix index 6a68a6bf78..39d9b2809f 100644 --- a/modules/package.nix +++ b/modules/package.nix @@ -10,7 +10,7 @@ let componentType = types.submodule [ ./component.nix - { _module.args = { inherit haskellLib; }; } + { _module.args = { inherit pkgs haskellLib; }; } # pass down common options as default values ({ lib, options, ... }: lib.mkDefault (lib.filterAttrs (n: _v: builtins.hasAttr n options) config)) ]; diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index a57d60a187..5fe966e4ac 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -331,6 +331,9 @@ in { ++ onAndroid (from "9.6" ./patches/ghc/ghc-9.6-COMPAT_R_ARM_PREL31.patch) ++ onAndroid (from "9.10" ./patches/ghc/ghc-9.10-ignore-libc.patch) + + # Fix for `fatal error: 'rts/Types.h' file not found` when building `primitive` + ++ onGhcjs (from "9.13" ./patches/ghc/ghc-9.13-ghcjs-rts-types.patch) ; in ({ ghc8107 = traceWarnOld "8.10" (final.callPackage ../compiler/ghc { diff --git a/overlays/patches/ghc/ghc-9.13-ghcjs-rts-types.patch b/overlays/patches/ghc/ghc-9.13-ghcjs-rts-types.patch new file mode 100644 index 0000000000..652e549f3c --- /dev/null +++ b/overlays/patches/ghc/ghc-9.13-ghcjs-rts-types.patch @@ -0,0 +1,12 @@ +diff --git a/rts/rts.cabal b/rts/rts.cabal +index 899e65d712..84dac99f54 100644 +--- a/rts/rts.cabal ++++ b/rts/rts.cabal +@@ -160,6 +160,7 @@ library + stg/MachRegs/x86.h + stg/MachRegsForHost.h + stg/Types.h ++ rts/Types.h + + else + -- If we are using an in-tree libffi then we must declare it as a bundled diff --git a/test/cabal-22/default.nix b/test/cabal-22/default.nix index ddbb51a63d..12345a395c 100644 --- a/test/cabal-22/default.nix +++ b/test/cabal-22/default.nix @@ -37,7 +37,7 @@ in recurseIntoAttrs { '' + # Aarch is statically linked and does not produce a .so file. # Musl is also statically linked, but it does make a .so file so we should check that still. - optionalString (!stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64) ('' + optionalString (!stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isDarwin) ('' printf "checking that executable is dynamically linked to system libraries... " >& 2 '' + optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) '' ${haskellLib.lddForTests} $exe | grep 'libc[.]so' @@ -57,7 +57,7 @@ in recurseIntoAttrs { '' + optionalString stdenv.isLinux '' ${haskellLib.lddForTests} $sofile | grep libHSghc-prim '' + optionalString stdenv.isDarwin '' - otool -L $sofile | grep libHSghc-prim + otool -L $sofile | grep libHSghc- '')) + '' touch $out diff --git a/test/cabal-simple-debug/default.nix b/test/cabal-simple-debug/default.nix index 7b02425276..58d7aab01f 100644 --- a/test/cabal-simple-debug/default.nix +++ b/test/cabal-simple-debug/default.nix @@ -39,7 +39,7 @@ in recurseIntoAttrs { else '' (${dwarfdump}/bin/dwarfdump $exe || true) | grep -c 'libraries/base/[A-Za-z0-9/]*\.hs' ''} - (${dwarfdump}/bin/dwarfdump $exe || true) | grep -c '/Main\.hs' + (${dwarfdump}/bin/dwarfdump $exe || true) | grep -c 'Main\.hs' touch $out ''; diff --git a/test/cabal.project.local b/test/cabal.project.local index 699d5493e7..d3e73d819b 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -9,8 +9,7 @@ if impl(ghc > 9.13) allow-newer: *:containers, *:time, *:ghc-bignum constraints: base-compat >=0.14.0, aeson >=2.2.1.0 -- From https://ghc.gitlab.haskell.org/head.hackage/cabal.constraints - constraints: extra ==1.7.14 - constraints: base-orphans <0.9.3 || >0.9.3 + -- Nothing needed right now -- This prevents hsc2hs from causing old versions of packages from being added to plan.json allow-newer: hsc2hs:* @@ -23,7 +22,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-ch17nc6wY2lr94j1+MULW7GuwtgQ8vz56yuPSADMmB8= + --sha256: sha256-Zu+OsPXt+tUllxC2LVJ3jneYGUH5GvdemZZPnynWaN0= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b diff --git a/test/plugin/default.nix b/test/plugin/default.nix index ae64225d96..3de0bc1b70 100644 --- a/test/plugin/default.nix +++ b/test/plugin/default.nix @@ -19,8 +19,8 @@ in recurseIntoAttrs { }; # Not sure why this breaks for ghc 8.10.7 - meta.disabled = compiler-nix-name == "ghc8107" - || builtins.elem compiler-nix-name [ "ghc9121" "ghc912120241215" "ghc91320241230" ] + meta.disabled = + builtins.elem compiler-nix-name [ "ghc91320250523" ] || stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isGhcjs || stdenv.hostPlatform.isWindows diff --git a/test/th-dlls/default.nix b/test/th-dlls/default.nix index 8ee93eea0f..33315dc011 100644 --- a/test/th-dlls/default.nix +++ b/test/th-dlls/default.nix @@ -22,14 +22,16 @@ in recurseIntoAttrs { meta.disabled = stdenv.hostPlatform.isGhcjs # On aarch64 this test also breaks form musl builds (including cross compiles on x86_64-linux) || (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isMusl) + # Not sure why this is failing with a seg fault + || (builtins.elem compiler-nix-name ["ghc9102" "ghc9102llvm"] && stdenv.hostPlatform.isAndroid && stdenv.hostPlatform.isAarch32) + # unhandled ELF relocation(Rel) type 10 + || (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_32) + + ## Old GHC versions (TODO remove) # Failed to lookup symbol: __aarch64_swp8_acq_rel || (builtins.elem compiler-nix-name ["ghc947" "ghc948"] && haskellLib.isCrossHost && stdenv.hostPlatform.isAarch64) - # Not sure why this is failing with a seg fault - || (builtins.elem compiler-nix-name ["ghc9102"] && stdenv.hostPlatform.isAndroid && stdenv.hostPlatform.isAarch32) # We have been unable to get windows cross compilation of th-orphans to work for GHC 8.10 using the latest nixpkgs || (compiler-nix-name == "ghc8107" && stdenv.hostPlatform.isWindows) - # unhandled ELF relocation(Rel) type 10 - || (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_32) ; ifdInputs = { @@ -41,7 +43,7 @@ in recurseIntoAttrs { build-ei = packages-ei.th-dlls.components.library; just-template-haskell-ei = packages-ei.th-dlls.components.exes.just-template-haskell; } // optionalAttrs - (!(builtins.elem compiler-nix-name ["ghc984" "ghc9121" "ghc912120241215" "ghc91320241230" "ghc912120250219"] && stdenv.buildPlatform.isx86_64 && stdenv.hostPlatform.isAarch64)) { + (!(builtins.elem compiler-nix-name ["ghc984" "ghc9122" "ghc91320250523"] && stdenv.buildPlatform.isx86_64 && stdenv.hostPlatform.isAarch64)) { # On for aarch64 cross compile on GHC this test is fails sometimes for non profiled builds # (and always for the profiled builds). # This may be related to the memory allocation changes made in 9.8.4 that