concatTextFile
pkgs.concatTextFile
Docs pulled from | This Revision | about 2 hours ago
concat a list of files to the nix store. The contents of files are added to the file in the store.
Example:
Writes my-file to /nix/store/
concatTextFile { name = "my-file"; files = [ drv1 "${drv2}/path/to/file" ]; }
See also the concatText
helper function below.
Writes executable my-file to /nix/store//bin/my-file
concatTextFile { name = "my-file"; files = [ drv1 "${drv2}/path/to/file" ]; executable = true; destination = "/bin/my-file"; }
Noogle detected
Implementation
The following is the current implementation of this function.
concatTextFile =
{
name, # the name of the derivation
files,
executable ? false, # run chmod +x ?
destination ? "", # relative path appended to $out eg "/bin/foo"
checkPhase ? "", # syntax checks, e.g. for scripts
meta ? { },
passthru ? { },
}:
runCommandLocal name
{
inherit
files
executable
checkPhase
meta
passthru
destination
;
}
''
file=$out$destination
mkdir -p "$(dirname "$file")"
cat $files > "$file"
if [ -n "$executable" ]; then
chmod +x "$file"
fi
eval "$checkPhase"
'';