diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-14 22:03:26 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-14 22:03:26 -0500 |
| commit | c071c02345bc9fd272e215b84aa09b9ab942a7ee (patch) | |
| tree | cb97c52974e5d59e72ad62d765d0313aac97c7a5 /Omni/Bild | |
| parent | 5f1289ca28249ed94cd5008c2e1b2574d6998ed6 (diff) | |
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 <amp@ampcode.com>
Diffstat (limited to 'Omni/Bild')
| -rw-r--r-- | Omni/Bild/Builder.nix | 9 |
1 files changed, 5 insertions, 4 deletions
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} \ |
