From a40068e04254d14c5215d80e010f00d842e60b06 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Fri, 1 May 2026 16:12:11 +0200 Subject: [PATCH 1/2] writeTextFile: use printf instead of echo This is safer in the case of large strings since it doesn't trigger "Argument list too long" errors. --- pkgs/build-support/trivial-builders/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index 10ad4ab187e3..04e284ca9652 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -146,7 +146,7 @@ rec { if [ -e "$textPath" ]; then mv "$textPath" "$target" else - echo -n "$text" > "$target" + printf "%s" "$text" > "$target" fi if [ -n "$executable" ]; then From 3f8bb455ddccf5acb6975d3e4598b8afe954fe89 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Mon, 23 Mar 2026 14:20:51 +0100 Subject: [PATCH 2/2] writeCBin: use structuredAttrs instead of passAsFile --- pkgs/build-support/trivial-builders/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index 04e284ca9652..e275aa1982a2 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -347,10 +347,10 @@ rec { { inherit pname code; executable = true; - passAsFile = [ "code" ]; # Pointless to do this on a remote machine. preferLocalBuild = true; allowSubstitutes = false; + __structuredAttrs = true; meta = { mainProgram = pname; }; @@ -358,7 +358,7 @@ rec { '' n=$out/bin/${pname} mkdir -p "$(dirname "$n")" - mv "$codePath" code.c + printf "%s" "$code" > code.c $CC -x c code.c -o "$n" '';