From ef85c3fe518186ae1effb0441a92c33468c475e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Thu, 11 May 2023 22:43:12 +0200 Subject: [PATCH] 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. --- nixos/modules/system/activation/top-level.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index c28e530cdc77..c4427149d9c9 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -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;