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
|
# make a template with placeholders
|
||||||
template_text = { name, text, outPath }:
|
template_text = {
|
||||||
|
name,
|
||||||
|
text,
|
||||||
|
outPath,
|
||||||
|
owner ? "root",
|
||||||
|
group ? owner,
|
||||||
|
mode ? "0400",
|
||||||
|
}:
|
||||||
pkgs.runCommand name {
|
pkgs.runCommand name {
|
||||||
textBeforeTemplate = text;
|
textBeforeTemplate = text;
|
||||||
script = ''
|
script = ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
${nix_templater}/bin/nix_templater ${builtins.placeholder "out"}/template ${builtins.placeholder "nix_template"} "${outPath}"
|
${nix_templater}/bin/nix_templater ${builtins.placeholder "out"}/template ${builtins.placeholder "nix_template"} "${outPath}"
|
||||||
|
chown ${owner}:${group} "${outPath}"
|
||||||
|
chmod ${mode} "${outPath}"
|
||||||
'';
|
'';
|
||||||
passAsFile = [ "script" "textBeforeTemplate" ];
|
passAsFile = [ "script" "textBeforeTemplate" ];
|
||||||
} ''
|
} ''
|
||||||
|
|
Loading…
Add table
Reference in a new issue