diff --git a/flake.nix b/flake.nix index 54723b2b8..09892c7d1 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 = { @@ -296,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" diff --git a/overlays/armv6l-linux.nix b/overlays/armv6l-linux.nix index e2df3cdaf..96ebbd0c6 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 d674140fe..125a1665f 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 7cfc74472..2ab1cc133 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) # - setupBuildFlags = map (opt: "--ghc-option=" + opt) (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 setupBuildFlags configureFlags; } +in { inherit testWrapper ghcOptions configureFlags; } diff --git a/overlays/windows.nix b/overlays/windows.nix index a1891268f..c7bc2172b 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 a134a793f..1961c4c74 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-njXNb4OInAsW0Nfyslum+Kw8X5HDYDXnaXBsW8hUUCU= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b