diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 78e671e8d22..7e73f98db78 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -20,13 +20,18 @@ rec { }: runCommand name { inherit text executable; + passAsFile = [ "text" ]; # Pointless to do this on a remote machine. preferLocalBuild = true; } '' n=$out${destination} mkdir -p "$(dirname "$n")" - echo -n "$text" > "$n" + if [ -e "$textPath" ]; then + mv "$textPath" "$n" + else + echo -n "$text" > "$n" + fi (test -n "$executable" && chmod +x "$n") || true '';