From b4de5e37147ec43e5e6e8cceaf9e08e56b100044 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Mon, 6 Oct 2025 01:41:06 +0100 Subject: [PATCH 1/4] haskellPackages: fix executable builds on pkgsCross.ucrt64 --- pkgs/development/compilers/ghc/common-hadrian.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 6538bbfe3608..5412b8fb1325 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -55,7 +55,8 @@ gmp, # If enabled, use -fPIC when compiling static libs. - enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform, + enableRelocatedStaticLibs ? + stdenv.targetPlatform != stdenv.hostPlatform && !stdenv.targetPlatform.isWindows, # Exceeds Hydra output limit (at the time of writing ~3GB) when cross compiled to riscv64. # A riscv64 cross-compiler fits into the limit comfortably. @@ -332,6 +333,8 @@ let # documentation) makes the GHC RTS able to load static libraries, which may # be needed for TemplateHaskell. This solution was described in # https://www.tweag.io/blog/2020-09-30-bazel-static-haskell + # + # Note `-fexternal-dynamic-refs` causes `undefined reference` errors when building GHC cross compiler for windows lib.optionals enableRelocatedStaticLibs [ "*.*.ghc.*.opts += -fPIC -fexternal-dynamic-refs" ] From b83fdf6232a0e9cb9eda855a1647a73d160554fb Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Thu, 23 Oct 2025 22:54:37 +0100 Subject: [PATCH 2/4] haskellPackages.Win32: mark as boot package --- pkgs/development/haskell-modules/configuration-common.nix | 1 - pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix | 1 + pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix | 1 + pkgs/development/haskell-modules/configuration-ghc-9.12.x.nix | 1 + pkgs/development/haskell-modules/configuration-ghc-9.16.x.nix | 1 + pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix | 1 + pkgs/development/haskell-modules/configuration-ghc-9.6.x.nix | 1 + pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix | 1 + 8 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 4f82feb47374..b0c0dc633e87 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1156,7 +1156,6 @@ with haskellLib; Cabal-ide-backend = dontCheck super.Cabal-ide-backend; # This package can't be built on non-Windows systems. - Win32 = overrideCabal (drv: { broken = !pkgs.stdenv.hostPlatform.isCygwin; }) super.Win32; inline-c-win32 = dontDistribute super.inline-c-win32; Southpaw = dontDistribute super.Southpaw; diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix index e7f0342aa470..1454ea63b514 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix @@ -36,4 +36,5 @@ self: super: { transformers = null; unix = null; xhtml = null; + Win32 = null; } diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix index ea22d88a9e40..7dc391912154 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix @@ -63,6 +63,7 @@ in transformers = null; unix = null; xhtml = null; + Win32 = null; # “Unfortunately we are unable to support GHC 9.10.” apply-refact = dontDistribute (markBroken super.apply-refact); diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.12.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.12.x.nix index c0a06d50b478..82630d5da2c8 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.12.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.12.x.nix @@ -66,6 +66,7 @@ with haskellLib; transformers = null; unix = null; xhtml = null; + Win32 = null; # # Hand pick versions that are compatible with ghc 9.12 and base 4.21 diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.16.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.16.x.nix index 0ff76cae4892..2a09d3f258c0 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.16.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.16.x.nix @@ -51,4 +51,5 @@ self: super: { transformers = null; unix = null; xhtml = null; + Win32 = null; } diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix index 347cf2dee573..0b723af7b578 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix @@ -50,6 +50,7 @@ self: super: { # GHC only bundles the xhtml library if haddock is enabled, check if this is # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463 xhtml = if self.ghc.hasHaddock or true then null else doDistribute self.xhtml_3000_4_0_0; + Win32 = null; # Becomes a core package in GHC >= 9.8 semaphore-compat = doDistribute self.semaphore-compat_1_0_0; diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.6.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.6.x.nix index 4e479de6d087..987897276982 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.6.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.6.x.nix @@ -58,6 +58,7 @@ in transformers = null; unix = null; xhtml = null; + Win32 = null; # Becomes a core package in GHC >= 9.8 semaphore-compat = doDistribute self.semaphore-compat_1_0_0; diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix index 82e1aa15642e..58e801c64ba9 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix @@ -61,6 +61,7 @@ in transformers = null; unix = null; xhtml = null; + Win32 = null; # Becomes a core package in GHC >= 9.10 os-string = doDistribute self.os-string_2_0_8; From 9cb747d793a97ccc88366186844c53afdd1d4c86 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Mon, 6 Oct 2025 02:58:55 +0100 Subject: [PATCH 3/4] haskellPackages.network: fix build on windows --- .../haskell-modules/configuration-windows.nix | 16 ++++++++++++++++ pkgs/development/haskell-modules/default.nix | 4 ++++ 2 files changed, 20 insertions(+) create mode 100644 pkgs/development/haskell-modules/configuration-windows.nix diff --git a/pkgs/development/haskell-modules/configuration-windows.nix b/pkgs/development/haskell-modules/configuration-windows.nix new file mode 100644 index 000000000000..aeb73a95649c --- /dev/null +++ b/pkgs/development/haskell-modules/configuration-windows.nix @@ -0,0 +1,16 @@ +{ pkgs, haskellLib }: + +let + inherit (pkgs) lib; +in + +with haskellLib; + +(self: super: { + # cabal2nix doesn't properly add dependencies conditional on os(windows) + network = + if pkgs.stdenv.hostPlatform.isWindows then + addBuildDepends [ self.temporary ] super.network + else + super.network; +}) diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index b6936742d710..08ee6219edff 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -15,6 +15,7 @@ configurationNix ? import ./configuration-nix.nix, configurationArm ? import ./configuration-arm.nix, configurationDarwin ? import ./configuration-darwin.nix, + configurationWindows ? import ./configuration-windows.nix, configurationJS ? import ./configuration-ghcjs-9.x.nix, }: @@ -42,6 +43,9 @@ let ++ lib.optionals stdenv.hostPlatform.isDarwin [ (configurationDarwin { inherit pkgs haskellLib; }) ] + ++ lib.optionals stdenv.hostPlatform.isWindows [ + (configurationWindows { inherit pkgs haskellLib; }) + ] ++ lib.optionals stdenv.hostPlatform.isGhcjs [ (configurationJS { inherit pkgs haskellLib; }) ]; From 34db4e48b710c5e388cce26801274f434d4a0204 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Mon, 6 Oct 2025 03:07:11 +0100 Subject: [PATCH 4/4] haskellPackages.streaming-commons: fix build on windows --- .../haskell-modules/configuration-windows.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/configuration-windows.nix b/pkgs/development/haskell-modules/configuration-windows.nix index aeb73a95649c..bef866162481 100644 --- a/pkgs/development/haskell-modules/configuration-windows.nix +++ b/pkgs/development/haskell-modules/configuration-windows.nix @@ -1,7 +1,7 @@ { pkgs, haskellLib }: let - inherit (pkgs) lib; + inherit (pkgs) fetchpatch lib; in with haskellLib; @@ -13,4 +13,11 @@ with haskellLib; addBuildDepends [ self.temporary ] super.network else super.network; + + # https://github.com/fpco/streaming-commons/pull/84 + streaming-commons = appendPatch (fetchpatch { + name = "fix-headers-case.patch"; + url = "https://github.com/fpco/streaming-commons/commit/6da611f63e9e862523ce6ee53262ddbc9681ae24.patch"; + sha256 = "sha256-giEQqXZfoiAvtCFohdgOoYna2Tnu5aSYAOUH8YVldi0="; + }) super.streaming-commons; })