From 4130a9f5d49c24bd5c5bc110b8ac2ec2d4f12170 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 16 Jul 2025 16:04:28 +1200 Subject: [PATCH 01/17] Add haskell-nix.templateHaskell.ghcOptions --- overlays/armv6l-linux.nix | 64 ++++++++++++++++++++------------------- overlays/linux-cross.nix | 15 +++------ overlays/mingw_w64.nix | 6 ++-- overlays/windows.nix | 40 +++++++++++++----------- test/cabal.project.local | 2 +- 5 files changed, 64 insertions(+), 63 deletions(-) diff --git a/overlays/armv6l-linux.nix b/overlays/armv6l-linux.nix index e2df3cdaf5..dde8e585df 100644 --- a/overlays/armv6l-linux.nix +++ b/overlays/armv6l-linux.nix @@ -1,42 +1,44 @@ final: prev: +let + isLinuxCross = + prev.haskell-nix.haskellLib.isCrossHost + && prev.hostPlatform.isLinux + && (prev.hostPlatform.isAarch32 + || prev.hostPlatform.isAarch64 + || prev.hostPlatform.isi686); + +in { - haskell-nix = prev.haskell-nix // ({ + haskell-nix = prev.haskell-nix // final.lib.optionalAttrs isLinuxCross ({ + templateHaskell = builtins.mapAttrs (compiler-nix-name: iserv-proxy-exes: + import ./linux-cross.nix { + inherit (final.stdenv) hostPlatform buildPlatform; + inherit (final) stdenv lib; + inherit (final.pkgsBuildBuild) writeShellScriptBin symlinkJoin; + inherit (final.haskell-nix) haskellLib; + qemu = final.pkgsBuildBuild.qemu; + inherit (final) gmp; + inherit (iserv-proxy-exes) iserv-proxy iserv-proxy-interpreter iserv-proxy-interpreter-prof; + }) final.haskell-nix.iserv-proxy-exes; defaultModules = prev.haskell-nix.defaultModules ++ [ ({ pkgs, buildModules, config, lib, ... }: let - withTH = import ./linux-cross.nix { - inherit (pkgs.stdenv) hostPlatform buildPlatform; - inherit (pkgs) stdenv lib; - inherit (pkgs.pkgsBuildBuild) writeShellScriptBin symlinkJoin; - inherit (pkgs.haskell-nix) haskellLib; - # qemu for linux - # Using `buildPackages.buildPackages` here fixes `python3Packages.pygobject3` issue. - qemu = pkgs.buildPackages.buildPackages.qemu; - -# wine = pkgs.buildPackages.winePackages.minimal; -# inherit (pkgs.windows) mingw_w64_pthreads; - inherit (pkgs) gmp; - # iserv-proxy needs to come from the buildPackages, as it needs to run on the - # build host. - inherit (final.haskell-nix.iserv-proxy-exes.${config.compiler.nix-name}) iserv-proxy iserv-proxy-interpreter iserv-proxy-interpreter-prof; - } // { - # we can perform testing of cross compiled test-suites by using wine. - # Therefore let's enable doCrossCheck here! - doCrossCheck = pkgs.stdenv.hostPlatform.isWindows; - }; + withTH = final.haskell-nix.templateHaskell.${config.compiler.nix-name}; in prev.haskell-nix.haskellLib.addPackageKeys { + inherit (withTH) configureFlags testWrapper; + + setupBuildFlags = map (opt: "--ghc-option=" + opt) withTH.ghcOptions + ++ lib.optionals pkgs.stdenv.hostPlatform.isAarch32 (map (opt: "--gcc-option=" + opt) [ "-fno-pic" "-fno-plt" ]) + # Also for GHC #15275 + ++ lib.optionals pkgs.stdenv.hostPlatform.isAarch64 ["--gcc-option=-fPIC"]; + + enableShared = lib.mkDefault false; + + doCrossCheck = true; + packages = { # clock 0.7.2 needs to be patched to support cross compilation. clock.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isAarch32 [ ({ version }: (if version == "0.7.2" then ./patches/clock-0.7.2.patch else null)) ]; - # nix calls this package crypto - # cryptonite-openssl.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ({ version }: if version == "0.7" then ./patches/cryptonite-openssl-0.7.patch else null) ]; - - # http-client.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ({ version }: if version == "0.5.14" then ./patches/http-client-0.5.14.patch else null) ]; - - # conduit.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ({ version }: if builtins.compareVersions version "1.3.1.1" < 0 then ./patches/conduit-1.3.0.2.patch else null) ]; - # streaming-commons.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/streaming-commons-0.2.0.0.patch ]; - # x509-system.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/x509-system-1.6.6.patch ]; - # file-embed-lzma.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/file-embed-lzma-0.patch ]; # Set all of these to [], as these form the # dependency graph of the libiserv, iserv-proxy, and iserv-remote @@ -59,7 +61,7 @@ final: prev: network.setupBuildFlags = []; unix.setupBuildFlags = []; }; - }// withTH + } ) ]; }); diff --git a/overlays/linux-cross.nix b/overlays/linux-cross.nix index d674140fe1..71c20f951c 100644 --- a/overlays/linux-cross.nix +++ b/overlays/linux-cross.nix @@ -31,8 +31,6 @@ let # ensure that we get a low pid < 65535 for android (If we run outside) # of nix build envs. - # we want this to hold only for arm (32 and 64bit) for now. - isLinuxCross = haskellLib.isCrossHost && hostPlatform.isLinux && (hostPlatform.isAarch32 || hostPlatform.isAarch64 || hostPlatform.isi686); qemuIservWrapperScript = enableProfiling: let interpreter = @@ -58,15 +56,12 @@ let ''; qemuIservWrapper = symlinkJoin { name = "iserv-wrapper"; paths = [ (qemuIservWrapperScript false) (qemuIservWrapperScript true) ]; }; configureFlags = lib.optional (hostPlatform.isAarch32 || hostPlatform.isAndroid) "--disable-split-sections"; - setupBuildFlags = map (opt: "--ghc-option=" + opt) ((lib.optionals isLinuxCross + ghcOptions = [ "-fexternal-interpreter" "-pgmi" "${qemuIservWrapper}/bin/iserv-wrapper" "-L${gmp}/lib" # Required to work-around https://gitlab.haskell.org/ghc/ghc/issues/15275 - ] ++ lib.optionals hostPlatform.isAarch64 ["-fPIC"])) - ++ lib.optionals hostPlatform.isAarch32 (map (opt: "--gcc-option=" + opt) [ "-fno-pic" "-fno-plt" ]) - # Also for GHC #15275 - ++ lib.optionals hostPlatform.isAarch64 ["--gcc-option=-fPIC"]; + ] ++ lib.optionals hostPlatform.isAarch64 ["-fPIC"]; # Wrapper for qemu testing qemuTestWrapper = writeShellScriptBin "test-wrapper" '' @@ -75,8 +70,6 @@ let ''; # Choose the appropriate test wrapper - testWrapper = lib.optional isLinuxCross "${qemuTestWrapper}/bin/test-wrapper"; + testWrapper = "${qemuTestWrapper}/bin/test-wrapper"; - enableShared = lib.mkDefault (!isLinuxCross); - -in { inherit configureFlags setupBuildFlags testWrapper enableShared; } +in { inherit configureFlags ghcOptions testWrapper; } diff --git a/overlays/mingw_w64.nix b/overlays/mingw_w64.nix index 7cfc744723..6e8f74a086 100644 --- a/overlays/mingw_w64.nix +++ b/overlays/mingw_w64.nix @@ -73,14 +73,14 @@ let ################################################################################ # Build logic (TH support via remote iserv via wine) # - setupBuildFlags = map (opt: "--ghc-option=" + opt) (lib.optionals hostPlatform.isWindows ([ + ghcOptions = lib.optionals hostPlatform.isWindows ([ "-fexternal-interpreter" "-pgmi" "${wineIservWrapper}/bin/iserv-wrapper" # TODO: this should be automatically injected based on the extraLibrary. "-L${mingw_w64_pthreads}/lib" "-L${mingw_w64_pthreads}/bin" "-L${gmp}/lib" - ])); + ]); ################################################################################ # Test logic via wine @@ -105,4 +105,4 @@ let ''; testWrapper = lib.optional hostPlatform.isWindows "${wineTestWrapper}/bin/test-wrapper"; -in { inherit testWrapper setupBuildFlags configureFlags; } +in { inherit testWrapper ghcOptions configureFlags; } diff --git a/overlays/windows.nix b/overlays/windows.nix index a1891268f3..7417cb190b 100644 --- a/overlays/windows.nix +++ b/overlays/windows.nix @@ -37,26 +37,32 @@ final: prev: configureFlags = (drv.configureFlags or []) ++ [ "--enable-static --disable-shared" ]; }); - haskell-nix = prev.haskell-nix // ({ + haskell-nix = prev.haskell-nix // final.lib.optionalAttrs final.stdenv.hostPlatform.isWindows ({ + templateHaskell = builtins.mapAttrs (compiler-nix-name: iserv-proxy-exes: + import ./mingw_w64.nix { + inherit (final.stdenv) hostPlatform; + inherit (final.pkgsBuildBuild) lib writeShellScriptBin; + wine = final.pkgsBuildBuild.winePackages.minimal; + inherit (final.windows) mingw_w64_pthreads; + inherit (final) gmp; + inherit (final.pkgsBuildBuild) symlinkJoin; + # iserv-proxy needs to come from the buildPackages, as it needs to run on the + # build host. + inherit (iserv-proxy-exes) iserv-proxy iserv-proxy-interpreter iserv-proxy-interpreter-prof; + }) final.haskell-nix.iserv-proxy-exes; defaultModules = prev.haskell-nix.defaultModules ++ [ ({ pkgs, buildModules, config, lib, ... }: let - withTH = import ./mingw_w64.nix { - inherit (pkgs.stdenv) hostPlatform; - inherit (pkgs.pkgsBuildBuild) lib writeShellScriptBin; - wine = pkgs.pkgsBuildBuild.winePackages.minimal; - inherit (pkgs.windows) mingw_w64_pthreads; - inherit (pkgs) gmp; - inherit (pkgs.pkgsBuildBuild) symlinkJoin; - # iserv-proxy needs to come from the buildPackages, as it needs to run on the - # build host. - inherit (final.haskell-nix.iserv-proxy-exes.${config.compiler.nix-name}) iserv-proxy iserv-proxy-interpreter iserv-proxy-interpreter-prof; - } // { - # we can perform testing of cross compiled test-suites by using wine. - # Therefore let's enable doCrossCheck here! - doCrossCheck = pkgs.stdenv.hostPlatform.isWindows; - }; + withTH = final.haskell-nix.templateHaskell.${config.compiler.nix-name}; in prev.haskell-nix.haskellLib.addPackageKeys { + inherit (withTH) configureFlags testWrapper; + + setupBuildFlags = map (opt: "--ghc-option=" + opt) withTH.ghcOptions; + + # we can perform testing of cross compiled test-suites by using wine. + # Therefore let's enable doCrossCheck here! + doCrossCheck = pkgs.stdenv.hostPlatform.isWindows; + packages = { # Apply https://github.com/haskell/cabal/pull/6055 @@ -115,7 +121,7 @@ final: prev: unix-time.components.library.libs = [ pkgs.windows.mingw_w64_pthreads ]; unix-time.postUnpack = "substituteInPlace */cbits/win_patch.h --replace Windows.h windows.h"; }; - } // withTH + } ) ]; }); diff --git a/test/cabal.project.local b/test/cabal.project.local index a134a793f2..52f16106fc 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -29,7 +29,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-V7cPUrMNDXF+LDrNKUE+co1MEmOquGUQ19Z6dJP8bFA= + --sha256: sha256-EXgjjlBrCHX80zkR5s7APh30dgT3e5O6BgsQRtCxT6c= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b From ccc8a48d8c449ef947f7c69f2fddde84b497a30f Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 16 Jul 2025 17:19:02 +1200 Subject: [PATCH 02/17] Update overlays/armv6l-linux.nix Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- overlays/armv6l-linux.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/armv6l-linux.nix b/overlays/armv6l-linux.nix index dde8e585df..96ebbd0c6f 100644 --- a/overlays/armv6l-linux.nix +++ b/overlays/armv6l-linux.nix @@ -10,7 +10,7 @@ let in { haskell-nix = prev.haskell-nix // final.lib.optionalAttrs isLinuxCross ({ - templateHaskell = builtins.mapAttrs (compiler-nix-name: iserv-proxy-exes: + templateHaskell = builtins.mapAttrs (_compiler-nix-name: iserv-proxy-exes: import ./linux-cross.nix { inherit (final.stdenv) hostPlatform buildPlatform; inherit (final) stdenv lib; From 4774b42085073f41703ec3be57835b0436c9b89d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 16 Jul 2025 17:19:10 +1200 Subject: [PATCH 03/17] Update overlays/windows.nix Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- overlays/windows.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/windows.nix b/overlays/windows.nix index 7417cb190b..c7bc2172bc 100644 --- a/overlays/windows.nix +++ b/overlays/windows.nix @@ -38,7 +38,7 @@ final: prev: }); haskell-nix = prev.haskell-nix // final.lib.optionalAttrs final.stdenv.hostPlatform.isWindows ({ - templateHaskell = builtins.mapAttrs (compiler-nix-name: iserv-proxy-exes: + templateHaskell = builtins.mapAttrs (_compiler-nix-name: iserv-proxy-exes: import ./mingw_w64.nix { inherit (final.stdenv) hostPlatform; inherit (final.pkgsBuildBuild) lib writeShellScriptBin; From d126e0a14919d51486ed11074f8589b2ace7bff2 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 17 Jul 2025 23:32:08 +1200 Subject: [PATCH 04/17] Disable macOS ci for now --- flake.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 54723b2b81..6b76536b7b 100644 --- a/flake.nix +++ b/flake.nix @@ -110,8 +110,9 @@ systems = [ "x86_64-linux" ] ++ (if runningHydraEvalTest then [ ] else [ - "x86_64-darwin" - "aarch64-darwin" + # TODO put these back when the macOS builders for ci.zw3rk.com are back online + # "x86_64-darwin" + # "aarch64-darwin" ]); nixpkgsArgs = { From 309c6ebbf1e9a2aea76953b46a8407e52c9ba128 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 17 Jul 2025 23:35:03 +1200 Subject: [PATCH 05/17] Bump head.hackage --- test/cabal.project.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cabal.project.local b/test/cabal.project.local index 52f16106fc..1961c4c749 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -29,7 +29,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-EXgjjlBrCHX80zkR5s7APh30dgT3e5O6BgsQRtCxT6c= + --sha256: sha256-njXNb4OInAsW0Nfyslum+Kw8X5HDYDXnaXBsW8hUUCU= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b From fe9847d620d3c251dcfdd0c943beca6253ef675d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 18 Jul 2025 09:36:18 +1200 Subject: [PATCH 06/17] Disable macOS ci for now --- flake.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 6b76536b7b..09892c7d19 100644 --- a/flake.nix +++ b/flake.nix @@ -297,10 +297,11 @@ hydraJobs.nix-tools = pkgs.releaseTools.aggregate { name = "nix-tools"; constituents = (if runningHydraEvalTest then [ ] else [ - "aarch64-darwin.nix-tools.static.zipped.nix-tools-static" - "x86_64-darwin.nix-tools.static.zipped.nix-tools-static" - "aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" - "x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" + # TODO put these back when the macOS builders for ci.zw3rk.com are back online + # "aarch64-darwin.nix-tools.static.zipped.nix-tools-static" + # "x86_64-darwin.nix-tools.static.zipped.nix-tools-static" + # "aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" + # "x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" ]) ++ [ "x86_64-linux.nix-tools.static.zipped.nix-tools-static" "x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64" From fe3584d761eb9003893709bff76e1348fc0789ab Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 18 Jul 2025 13:05:40 +1200 Subject: [PATCH 07/17] Fix testWrapper type --- overlays/linux-cross.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/linux-cross.nix b/overlays/linux-cross.nix index 71c20f951c..125a1665fc 100644 --- a/overlays/linux-cross.nix +++ b/overlays/linux-cross.nix @@ -70,6 +70,6 @@ let ''; # Choose the appropriate test wrapper - testWrapper = "${qemuTestWrapper}/bin/test-wrapper"; + testWrapper = [ "${qemuTestWrapper}/bin/test-wrapper" ]; in { inherit configureFlags ghcOptions testWrapper; } From 567a347ad7cae16bfa457417308ec987997b167f Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 18 Jul 2025 13:11:11 +1200 Subject: [PATCH 08/17] Simplify mingw_w64.nix --- overlays/mingw_w64.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/overlays/mingw_w64.nix b/overlays/mingw_w64.nix index 6e8f74a086..2ab1cc133f 100644 --- a/overlays/mingw_w64.nix +++ b/overlays/mingw_w64.nix @@ -13,7 +13,7 @@ }: let - configureFlags = lib.optional hostPlatform.isWindows "--disable-split-sections"; + configureFlags = ["--disable-split-sections"]; wineIservWrapperScript = enableProfiling: let @@ -73,14 +73,14 @@ let ################################################################################ # Build logic (TH support via remote iserv via wine) # - ghcOptions = lib.optionals hostPlatform.isWindows ([ + ghcOptions = [ "-fexternal-interpreter" "-pgmi" "${wineIservWrapper}/bin/iserv-wrapper" # TODO: this should be automatically injected based on the extraLibrary. "-L${mingw_w64_pthreads}/lib" "-L${mingw_w64_pthreads}/bin" "-L${gmp}/lib" - ]); + ]; ################################################################################ # Test logic via wine @@ -103,6 +103,6 @@ let export Path ${wine}/bin/wine64 $@ ''; - testWrapper = lib.optional hostPlatform.isWindows "${wineTestWrapper}/bin/test-wrapper"; + testWrapper = ["${wineTestWrapper}/bin/test-wrapper"]; in { inherit testWrapper ghcOptions configureFlags; } From 7ae37af056184cd9aefda0d0c87e284db8717d15 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 22 Jul 2025 21:31:37 +1200 Subject: [PATCH 09/17] Fix using hix `--command` and `--projectArgs` together --- hix/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hix/default.nix b/hix/default.nix index c0cbcb96d4..745bf46cd9 100644 --- a/hix/default.nix +++ b/hix/default.nix @@ -92,6 +92,7 @@ let --projectArgs) printf %s "$2" > "$HIX_TMPDIR/projectArgs.nix" shift + args+=(--override-input projectArgs "$(realpath "$HIX_TMPDIR")") ;; --supportedSystems) printf %s "$2" > "$HIX_TMPDIR/supportedSystems.nix" @@ -166,7 +167,6 @@ let cp $HIX_FLAKE $FLAKE/flake.nix chmod +w $FLAKE/flake.nix fi - args+=(--override-input projectArgs "$(realpath "$HIX_TMPDIR")") nix $cmd "''${args[@]}" ;; esac From 5212c99a9c6fdf9451a0fd7c080f71cb5fcac981 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 22 Jul 2025 21:33:33 +1200 Subject: [PATCH 10/17] Move libsodium fix into test/overlay.nix --- ci.nix | 5 +---- test/overlay.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 test/overlay.nix diff --git a/ci.nix b/ci.nix index bcb3ad6532..f949c7085a 100644 --- a/ci.nix +++ b/ci.nix @@ -29,12 +29,9 @@ (final: prev: { haskell-nix = prev.haskell-nix // { inherit checkMaterialization; - extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings or {} // { - "libsodium" = [ "libsodium-18" ]; - }; }; - libsodium-18 = (final.callPackage (inputs.nixpkgs-2311 + "/pkgs/development/libraries/libsodium") {}).overrideAttrs (_: { dontDisableStatic = true; }); }) + (import ./test/overlay.nix) ]; # Needed for dwarf tests config = haskellNix.config // { diff --git a/test/overlay.nix b/test/overlay.nix new file mode 100644 index 0000000000..8d8d3dfada --- /dev/null +++ b/test/overlay.nix @@ -0,0 +1,8 @@ +final: prev: { + haskell-nix = prev.haskell-nix // { + extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings or {} // { + "libsodium" = [ "libsodium-18" ]; + }; + }; + libsodium-18 = (final.callPackage (final.haskell-nix.sources.nixpkgs-2311 + "/pkgs/development/libraries/libsodium") {}).overrideAttrs (_: { dontDisableStatic = true; }); +} From 55d6ca31f5d3c3f95a0c91d59688da6ec75c6336 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 22 Jul 2025 21:35:48 +1200 Subject: [PATCH 11/17] Fix iserv-proxy in dev shells --- builder/default.nix | 2 +- builder/ghc-for-component-wrapper.nix | 6 +++--- builder/shell-for.nix | 6 ++++++ test/th-dlls/default.nix | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/builder/default.nix b/builder/default.nix index 27ae6f2f3e..c813f87e7d 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -41,7 +41,7 @@ let # component builder and for nix-shells. ghcForComponent = import ./ghc-for-component-wrapper.nix { inherit lib ghc haskellLib; - inherit (buildPackages) stdenv; + inherit (pkgs) stdenv; inherit (buildPackages.buildPackages) runCommand makeWrapper; inherit (buildPackages.buildPackages.xorg) lndir; }; diff --git a/builder/ghc-for-component-wrapper.nix b/builder/ghc-for-component-wrapper.nix index ad8a15fc5c..3c4c219c27 100644 --- a/builder/ghc-for-component-wrapper.nix +++ b/builder/ghc-for-component-wrapper.nix @@ -14,6 +14,7 @@ , postInstall ? "" , enableDWARF , plugins +, ghcOptions ? [] }: let @@ -107,7 +108,7 @@ let --set "NIX_${ghcCommandCaps}PKG" "$wrappedGhc/bin/${ghcCommand}-pkg" \ --set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \ --set "GHC_PLUGINS" "$GHC_PLUGINS" \ - --set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}" + --set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"${lib.concatMapStrings (o: " --add-flags ${o}") ghcOptions} fi done @@ -159,8 +160,7 @@ let inherit script targetPrefix; inherit (ghc) version meta; }; - propagatedBuildInputs = configFiles.libDeps; - nativeBuildInputs = [ghc]; + propagatedBuildInputs = configFiles.libDeps ++ [stdenv.cc ghc]; } ('' mkdir -p $out/configFiles configFiles=$out/configFiles diff --git a/builder/shell-for.nix b/builder/shell-for.nix index 2bb4ede064..27e19ab3bc 100644 --- a/builder/shell-for.nix +++ b/builder/shell-for.nix @@ -143,6 +143,7 @@ let ''; inherit enableDWARF; plugins = []; + ghcOptions = haskell-nix.templateHaskell.${compiler.nix-name}.ghcOptions or []; }; hoogleIndex = let @@ -192,11 +193,16 @@ in ''} $(builtin type -P "${ghcEnv.targetPrefix}pkg-config" &> /dev/null && echo "--with-pkg-config=${ghcEnv.targetPrefix}pkg-config") \ "$@" ''); + propagatedBuildInputs = mkDrvArgs.propagateBuildInputs or [] ++ ghcEnv.drv.propagatedBuildInputs; phases = ["installPhase"]; installPhase = '' echo "${"Shell for " + toString (builtins.map (p : p.identifier.name) selectedPackages)}" echo $nativeBuildInputs $buildInputs > $out ''; + shellHook = mkDrvArgs.shellHook or "" + lib.optionalString stdenv.hostPlatform.isWindows '' + + export pkgsHostTargetAsString="''${pkgsHostTarget[@]}" + ''; # This helps tools like `ghcide` (that use the ghc api) to find # the correct global package DB. diff --git a/test/th-dlls/default.nix b/test/th-dlls/default.nix index 8ec1425654..79f2caefb8 100644 --- a/test/th-dlls/default.nix +++ b/test/th-dlls/default.nix @@ -7,12 +7,12 @@ let project = externalInterpreter: project' { inherit compiler-nix-name evalPackages; src = testSrc "th-dlls"; - cabalProjectLocal = builtins.readFile ../cabal.project.local; modules = import ../modules.nix ++ [({pkgs, ...}: lib.optionalAttrs externalInterpreter { packages.th-dlls.components.library.ghcOptions = [ "-fexternal-interpreter" ]; # Static openssl seems to fail to load in iserv for musl packages.HsOpenSSL.components.library.libs = lib.optional pkgs.stdenv.hostPlatform.isMusl (pkgs.openssl.override { static = false; }); })]; + shell.nativeBuildInputs = [ buildPackages.haskell-nix.nix-tools-unchecked.exes.cabal ]; }; packages = (project false).hsPkgs; From 65e78c01a59cfd58caf11164faf92a6d673167ba Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 22 Jul 2025 21:37:28 +1200 Subject: [PATCH 12/17] Bump head.hackage --- test/cabal.project.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cabal.project.local b/test/cabal.project.local index 1961c4c749..172b33ade9 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -29,7 +29,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-njXNb4OInAsW0Nfyslum+Kw8X5HDYDXnaXBsW8hUUCU= + --sha256: sha256-wf3cnxaHiLGflr3nNluoxURMqP9ehhaxG9pvXz9cPCI= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b From 24c0c074252c5aa619837e36bbe8b22689c45cbf Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 23 Jul 2025 00:46:26 +1200 Subject: [PATCH 13/17] Bump head.hackage --- test/cabal.project.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cabal.project.local b/test/cabal.project.local index 172b33ade9..1bd2c228cc 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -29,7 +29,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-wf3cnxaHiLGflr3nNluoxURMqP9ehhaxG9pvXz9cPCI= + --sha256: sha256-0cuvKmWGj5xuN3kJ6W9mv09bn6PAH4nTBK0QyEPc7Hg= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b From c5e8e92d80ad743c820241c3d3978fb93c40ba23 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 23 Jul 2025 00:46:45 +1200 Subject: [PATCH 14/17] Fix for musl --- builder/ghc-for-component-wrapper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/ghc-for-component-wrapper.nix b/builder/ghc-for-component-wrapper.nix index 3c4c219c27..e1c86e5c44 100644 --- a/builder/ghc-for-component-wrapper.nix +++ b/builder/ghc-for-component-wrapper.nix @@ -24,7 +24,7 @@ let libDir = "$wrappedGhc/${configFiles.libDir}"; docDir = "$wrappedGhc/share/doc/ghc/html"; # For musl we can use haddock from the buildGHC - haddock = if stdenv.targetPlatform.isMusl + haddock = if stdenv.hostPlatform.isMusl then ghc.buildGHC else ghc; From 64fed0e98d49efd47295cb45bf654cc20852fa1e Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 23 Jul 2025 09:54:47 +1200 Subject: [PATCH 15/17] Fix for ghcjs --- builder/ghc-for-component-wrapper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/ghc-for-component-wrapper.nix b/builder/ghc-for-component-wrapper.nix index e1c86e5c44..a96f2302dc 100644 --- a/builder/ghc-for-component-wrapper.nix +++ b/builder/ghc-for-component-wrapper.nix @@ -160,7 +160,7 @@ let inherit script targetPrefix; inherit (ghc) version meta; }; - propagatedBuildInputs = configFiles.libDeps ++ [stdenv.cc ghc]; + propagatedBuildInputs = configFiles.libDeps ++ lib.optional stdenv.hasCC stdenv.cc ++ [ghc]; } ('' mkdir -p $out/configFiles configFiles=$out/configFiles From 284f3dc161ff76c9cbcb3998130af120c153d13b Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 23 Jul 2025 15:47:03 +1200 Subject: [PATCH 16/17] Better way to disable macOS --- flake.nix | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 09892c7d19..721aaf1f3a 100644 --- a/flake.nix +++ b/flake.nix @@ -91,7 +91,8 @@ callFlake = import flake-compat; ifdLevel = 3; - runningHydraEvalTest = false; + # TODO set this to false when the macOS builders for ci.zw3rk.com are back online + runningHydraEvalTest = true; defaultCompiler = "ghc967"; config = import ./config.nix; @@ -110,9 +111,8 @@ systems = [ "x86_64-linux" ] ++ (if runningHydraEvalTest then [ ] else [ - # TODO put these back when the macOS builders for ci.zw3rk.com are back online - # "x86_64-darwin" - # "aarch64-darwin" + "x86_64-darwin" + "aarch64-darwin" ]); nixpkgsArgs = { @@ -297,11 +297,10 @@ hydraJobs.nix-tools = pkgs.releaseTools.aggregate { name = "nix-tools"; constituents = (if runningHydraEvalTest then [ ] else [ - # TODO put these back when the macOS builders for ci.zw3rk.com are back online - # "aarch64-darwin.nix-tools.static.zipped.nix-tools-static" - # "x86_64-darwin.nix-tools.static.zipped.nix-tools-static" - # "aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" - # "x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" + "aarch64-darwin.nix-tools.static.zipped.nix-tools-static" + "x86_64-darwin.nix-tools.static.zipped.nix-tools-static" + "aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" + "x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd" ]) ++ [ "x86_64-linux.nix-tools.static.zipped.nix-tools-static" "x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64" From d80663174cc1df23121a4efa23af0cb4b564adf1 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 23 Jul 2025 15:47:30 +1200 Subject: [PATCH 17/17] Fix eval checks --- .github/workflows/pipeline.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 2c3c022684..706bc60ad2 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -223,14 +223,18 @@ jobs: steps: - uses: actions/checkout@v4 - name: "Check that evaluation of hydra jobs works without using remote builders for GHC 9.6.7" - run: nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc967-native --show-trace --builders '' + run: | + sed -i 's/runningHydraEvalTest = true;/runningHydraEvalTest = false;/' flake.nix + nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc967-native --show-trace --builders '' hydra-without-remote-builders-ghc9102: runs-on: [self-hosted, linux] steps: - uses: actions/checkout@v4 - name: "Check that evaluation of hydra jobs works without using remote builders for GHC 9.10.2" - run: nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc9102-native --show-trace --builders '' + run: | + sed -i 's/runningHydraEvalTest = true;/runningHydraEvalTest = false;/' flake.nix + nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc9102-native --show-trace --builders '' hix-cabal: runs-on: [self-hosted, linux]