Commit ef85c3fe authored by Bjørn Forsman's avatar Bjørn Forsman
Browse files

nixos: use passAsFile to avoid "Argument list too long" error

This patch fixes "Argument list too long" build failure when passing a
list of store paths to system.extraDependencies that exceeds Linux'
MAX_ARG_STRLEN limit of 128 KiB. With the shortest possible derivation
names (one byte), the 128 KiB limit is equivalent to about 2850
derivations. With longer derivations names, the limit is hit earlier.
Fix this restriction.
parent 57e7968e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ let

      ${config.system.systemBuilderCommands}

      echo -n "$extraDependencies" > $out/extra-dependencies
      cp "$extraDependenciesPath" "$out/extra-dependencies"

      ${optionalString (!config.boot.isContainer && config.boot.bootspec.enable) ''
        ${config.boot.bootspec.writer}
@@ -98,6 +98,7 @@ let
    name = "nixos-system-${config.system.name}-${config.system.nixos.label}";
    preferLocalBuild = true;
    allowSubstitutes = false;
    passAsFile = [ "extraDependencies" ];
    buildCommand = systemBuilder;

    inherit (pkgs) coreutils;