From c435b9a8a87f558cc76c761d6d4ba7a9ae69740c Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 14 Nov 2025 23:12:56 -0500 Subject: 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 --- Omni/Bild/Builder.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Omni/Bild') 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 -- cgit v1.2.3