mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
writeTextFile: Use passAsFile if available
This commit is contained in:
parent
953466fcba
commit
5c9319ddac
@ -20,13 +20,18 @@ rec {
|
|||||||
}:
|
}:
|
||||||
runCommand name
|
runCommand name
|
||||||
{ inherit text executable;
|
{ inherit text executable;
|
||||||
|
passAsFile = [ "text" ];
|
||||||
# Pointless to do this on a remote machine.
|
# Pointless to do this on a remote machine.
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
n=$out${destination}
|
n=$out${destination}
|
||||||
mkdir -p "$(dirname "$n")"
|
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
|
(test -n "$executable" && chmod +x "$n") || true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user