mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
Merge pull request #6411 from NixOS/passAsFile
writeTextFile: Use passAsFile if available
This commit is contained in:
commit
1f400ea463
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue