From c071c02345bc9fd272e215b84aa09b9ab942a7ee Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 14 Nov 2025 22:03:26 -0500 Subject: Fix per-module link: copy .hi files locally instead of using -i paths GHC --make was treating -i /nix/store/.../hidir paths as compilation targets. Solution: Copy all .hi files to local directory and use -i. only. Also make hsGraph optional with 'or null' for backward compatibility with old bild binaries during bootstrap. Amp-Thread-ID: https://ampcode.com/threads/T-fe68faaf-1c1d-4c43-a377-1cf5e6cffb3a Co-authored-by: Amp --- Omni/Bild/Builder.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Omni/Bild/Builder.nix') diff --git a/Omni/Bild/Builder.nix b/Omni/Bild/Builder.nix index fa732be..6610a27 100644 --- a/Omni/Bild/Builder.nix +++ b/Omni/Bild/Builder.nix @@ -116,7 +116,7 @@ with bild; let }; haskell = - if target.hsGraph == null + if (target.hsGraph or null) == null then # Monolithic build (fallback for TH/cycles) stdenv.mkDerivation rec { @@ -228,14 +228,15 @@ with bild; let dontConfigure = true; buildPhase = let pkgFlags = lib.strings.concatMapStringsSep " " (p: "-package ${p}") target.langdeps; - hiDirs = lib.attrsets.mapAttrsToList (_modName: drv: "${drv}/hidir") modules; - iFlags = lib.strings.concatMapStringsSep " " (d: "-i ${d}") hiDirs; + copyHiFiles = lib.strings.concatMapStringsSep "\n" (drv: "cp -rL ${drv}/hidir/. . 2>/dev/null || true") (lib.attrsets.attrValues modules); in '' set -eux echo "Starting custom link phase with ${builtins.toString (builtins.length objectPaths)} object files" + ${copyHiFiles} + chmod -R +w . || true ${ghcPkg}/bin/ghc --make \ ${target.quapath} \ - -i. ${iFlags} \ + -i. \ ${pkgFlags} \ -threaded \ -o ${name} \ -- cgit v1.2.3