From 6d583284df4593912d4fe88d34ddccc4f61308a4 Mon Sep 17 00:00:00 2001 From: Enrico Borba Date: Fri, 31 Mar 2023 21:45:38 -1000 Subject: [PATCH] chore: Nix: fix `depRoot` with huge number of deps (#2179) If `deps` or `depRoots` are too large, bash will carsh when executing the modified script. This is because there are OS-level limits on the size of environment variables. This commit changes the script so that `deps` and `depRoots` are written to files instead of being passed as environment variables. --- nix/buildLeanPackage.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nix/buildLeanPackage.nix b/nix/buildLeanPackage.nix index d6641d21b1..71bf36e3e6 100644 --- a/nix/buildLeanPackage.nix +++ b/nix/buildLeanPackage.nix @@ -69,12 +69,14 @@ with builtins; let name = "${name}-depRoot"; inherit deps; depRoots = map (drv: drv.LEAN_PATH) deps; + + passAsFile = [ "deps" "depRoots" ]; buildCommand = '' mkdir -p $out - for i in $depRoots; do + for i in $(cat $depRootsPath); do cp -dru --no-preserve=mode $i/. $out done - for i in $deps; do + for i in $(cat $depsPath); do cp -drsu --no-preserve=mode $i/. $out done '';