summaryrefslogtreecommitdiff
path: root/Omni/Bild
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-14 22:50:55 -0500
committerBen Sima <ben@bsima.me>2025-11-14 22:50:55 -0500
commit0c4c0dadc71b3300e63b55d56bf86cbb2d89986a (patch)
treea6e243c1f5ed8bb4d627fbcb380835d6471ef09c /Omni/Bild
parent461e9a9c410eb915c79753d07559b4dc69b1c238 (diff)
fix(bild): per-module builds + exit code propagation
- Fix nixBuild to propagate exit code from realise step - Previously used >> which discarded exit code - Now checks realise result before running symlink - Fixes false success checkmarks on build failures - Fix per-module Nix derivations - Use cp -rL instead of tar (src is directory not tarball) - Add coreutils and findutils to pkgs - Copy deps to . and use -i. for GHC - Use find with --parents to preserve module hierarchy - Set dontStrip=true to avoid fixup script errors - Tested: Example.hs, Task.hs, Dragons.hs, Bild.hs all build - Known issue: makeWrapper fixup scripts have unbound vars (Nix bug)
Diffstat (limited to 'Omni/Bild')
-rw-r--r--Omni/Bild/Builder.nix20
1 files changed, 10 insertions, 10 deletions
diff --git a/Omni/Bild/Builder.nix b/Omni/Bild/Builder.nix
index b71a12f..37ff821 100644
--- a/Omni/Bild/Builder.nix
+++ b/Omni/Bild/Builder.nix
@@ -193,24 +193,23 @@ with bild; let
(let
copyDeps =
lib.strings.concatMapStringsSep "\n" (d: ''
- cp -rL ${d}/hidir/. hidir/ 2>/dev/null || true
+ ${pkgs.coreutils}/bin/cp -rL ${d}/hidir/. . 2>/dev/null || true
+ ${pkgs.coreutils}/bin/cp -rL ${d}/odir/. . 2>/dev/null || true
'')
depDrvs;
in ''
set -eu
- tar xzf $src
- cd source
- mkdir -p hidir odir
+ ${pkgs.coreutils}/bin/cp -rL $src/. .
+ ${pkgs.coreutils}/bin/chmod -R +w .
${copyDeps}
- chmod -R +w hidir || true
+ ${pkgs.coreutils}/bin/chmod -R +w . || true
${ghcPkg}/bin/ghc -c \
-Wall -Werror -haddock -Winvalid-haddock \
- -i. -ihidir \
- -odir odir -hidir hidir \
+ -i. \
${node.nodePath}
- mkdir -p $out/hidir $out/odir
- cp -r hidir/* $out/hidir/ || true
- cp -r odir/* $out/odir/ || true
+ ${pkgs.coreutils}/bin/mkdir -p $out/hidir $out/odir
+ ${pkgs.findutils}/bin/find . -name '*.hi' -exec ${pkgs.coreutils}/bin/cp --parents {} $out/hidir/ \;
+ ${pkgs.findutils}/bin/find . -name '*.o' -exec ${pkgs.coreutils}/bin/cp --parents {} $out/odir/ \;
'')
];
};
@@ -227,6 +226,7 @@ with bild; let
inherit name CODEROOT src;
nativeBuildInputs = [makeWrapper];
dontConfigure = true;
+ dontStrip = true;
buildPhase = let
pkgFlags = lib.strings.concatMapStringsSep " " (p: "-package ${p}") target.langdeps;
copyHiFiles = lib.strings.concatMapStringsSep "\n" (drv: "cp -rL ${drv}/hidir/. . 2>/dev/null || true") (lib.attrsets.attrValues modules);