* Cleanup.
svn path=/nixpkgs/trunk/; revision=13161
This commit is contained in:
parent
afb0530e3d
commit
f04e3944e5
@ -433,22 +433,24 @@ let
|
|||||||
|
|
||||||
symlinkJoin = name: paths: runCommand name {inherit paths;} "mkdir -p $out; for i in $paths; do ${xorg.lndir}/bin/lndir $i $out; done";
|
symlinkJoin = name: paths: runCommand name {inherit paths;} "mkdir -p $out; for i in $paths; do ${xorg.lndir}/bin/lndir $i $out; done";
|
||||||
|
|
||||||
# single text file derivation
|
# Create a single file.
|
||||||
writeTextFile = { name, # the name of the derivation
|
writeTextFile =
|
||||||
text,
|
{ name # the name of the derivation
|
||||||
executable ? false, # run chmod +x ?
|
, text
|
||||||
destination ? "" # relative path appended to $out eg "/bin/foo"
|
, executable ? false # run chmod +x ?
|
||||||
} :
|
, destination ? "" # relative path appended to $out eg "/bin/foo"
|
||||||
|
}:
|
||||||
runCommand name {inherit text executable; } ''
|
runCommand name {inherit text executable; } ''
|
||||||
n=$out${destination}
|
n=$out${destination}
|
||||||
mkdir -p "$(dirname "$n")"
|
mkdir -p "$(dirname "$n")"
|
||||||
echo -n "$text" > "$n"
|
echo -n "$text" > "$n"
|
||||||
[ -n "$executable"] && chmod +x "$n"
|
[ -n "$executable"] && chmod +x "$n"
|
||||||
'';
|
'';
|
||||||
# the following write* functions are depreceated. You should use writeTextFile instead
|
|
||||||
writeText = name: text: runCommand name {inherit text;} "echo -n \"$text\" > $out";
|
# Shorthands for `writeTextFile'.
|
||||||
writeScript = name: text: runCommand name {inherit text;} "echo -n \"$text\" > $out; chmod +x $out";
|
writeText = name: text: writeTextFile {inherit name text;};
|
||||||
writeScriptBin = name: text: runCommand name {inherit text;} "mkdir -p \$out/bin; echo -n \"\$text\" > \$out/bin/\$name ; chmod +x \$out/bin/\$name";
|
writeScript = name: text: writeTextFile {inherit name text; executable = true;};
|
||||||
|
writeScriptBin = name: text: writeTextFile {inherit name text; executable = true; destination = "/bin/${name}";};
|
||||||
|
|
||||||
# entries is a list of attribute sets like { name = "name" ; path = "/nix/store/..."; }
|
# entries is a list of attribute sets like { name = "name" ; path = "/nix/store/..."; }
|
||||||
linkFarm = name: entries: runCommand name {} ("mkdir -p $out; cd $out; \n" +
|
linkFarm = name: entries: runCommand name {} ("mkdir -p $out; cd $out; \n" +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user