From 5c9319ddac964ae78d947a47b3f0b36fd0efda51 Mon Sep 17 00:00:00 2001 From: Wout Mertens Date: Wed, 18 Feb 2015 01:08:03 +0100 Subject: [PATCH] writeTextFile: Use passAsFile if available --- pkgs/build-support/trivial-builders.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 78e671e8d229..7e73f98db782 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 '';