Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
dfac12a864 | |||
0e9fb00940 |
1 changed files with 10 additions and 1 deletions
11
lib.nix
11
lib.nix
|
@ -7,12 +7,21 @@
|
|||
};
|
||||
|
||||
# make a template with placeholders
|
||||
template_text = { name, text, outPath }:
|
||||
template_text = {
|
||||
name,
|
||||
text,
|
||||
outPath,
|
||||
owner ? "root",
|
||||
group ? owner,
|
||||
mode ? "0400",
|
||||
}:
|
||||
pkgs.runCommand name {
|
||||
textBeforeTemplate = text;
|
||||
script = ''
|
||||
#!/bin/sh
|
||||
${nix_templater}/bin/nix_templater ${builtins.placeholder "out"}/template ${builtins.placeholder "nix_template"} "${outPath}"
|
||||
chown ${owner}:${group} "${outPath}"
|
||||
chmod ${mode} "${outPath}"
|
||||
'';
|
||||
passAsFile = [ "script" "textBeforeTemplate" ];
|
||||
} ''
|
||||
|
|
Loading…
Add table
Reference in a new issue