summaryrefslogtreecommitdiff
path: root/Omni/Bild
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-14 23:12:56 -0500
committerBen Sima <ben@bsima.me>2025-11-14 23:12:56 -0500
commitc435b9a8a87f558cc76c761d6d4ba7a9ae69740c (patch)
tree6da3950e9cccb98d09706a3de53e5c671b9e8644 /Omni/Bild
parent8eb102bf5131f29879006252c62c4b2237a7d231 (diff)
fix(bild): per-module cp overwrites with -f and chmod after each copy
When building per-module derivations, copying dependency .hi files was failing silently because: 1. First dep copies read-only Alpha.hi from nix store 2. Second dep also has Alpha.hi (transitive dep) and tries to overwrite 3. cp fails with permission denied but error is hidden by '|| true' Fixed by: - Add -f flag to cp to force overwrite - Run chmod -R +w after each dependency copy - This allows later deps to overwrite shared files like Alpha.hi Tested: Biz/Que/Host.hs now builds successfully with per-module derivations
Diffstat (limited to 'Omni/Bild')
-rw-r--r--Omni/Bild/Builder.nix13
1 files changed, 8 insertions, 5 deletions
diff --git a/Omni/Bild/Builder.nix b/Omni/Bild/Builder.nix
index e1b0122..603cab9 100644
--- a/Omni/Bild/Builder.nix
+++ b/Omni/Bild/Builder.nix
@@ -193,8 +193,9 @@ with bild; let
(let
copyDeps =
lib.strings.concatMapStringsSep "\n" (d: ''
- ${pkgs.coreutils}/bin/cp -rL ${d}/hidir/. . 2>/dev/null || true
- ${pkgs.coreutils}/bin/cp -rL ${d}/odir/. . 2>/dev/null || true
+ ${pkgs.coreutils}/bin/cp -rfL ${d}/hidir/. . 2>/dev/null || true
+ ${pkgs.coreutils}/bin/cp -rfL ${d}/odir/. . 2>/dev/null || true
+ ${pkgs.coreutils}/bin/chmod -R +w . 2>/dev/null || true
'')
depDrvs;
in ''
@@ -202,7 +203,6 @@ with bild; let
${pkgs.coreutils}/bin/cp -rL $src/. .
${pkgs.coreutils}/bin/chmod -R +w .
${copyDeps}
- ${pkgs.coreutils}/bin/chmod -R +w . || true
${ghcPkg}/bin/ghc -c \
-Wall -Werror -haddock -Winvalid-haddock \
-i. \
@@ -215,10 +215,13 @@ with bild; let
};
# Recursive attrset of all module derivations
+ # mapAttrs' creates {sanitized-name = drv}, while nodeImports use original names
modules = lib.fix (self:
- lib.mapAttrs
+ lib.mapAttrs'
(modName: node:
- mkModuleDrv modName node (map (dep: builtins.getAttr dep self) node.nodeImports))
+ lib.nameValuePair (sanitize modName) (
+ mkModuleDrv modName node (map (dep: builtins.getAttr (sanitize dep) self) node.nodeImports)
+ ))
graph.graphModules);
in
# Final link derivation