set file rights
This commit is contained in:
parent
437fd19b72
commit
0e9fb00940
1 changed files with 10 additions and 1 deletions
11
lib.nix
11
lib.nix
|
@ -7,7 +7,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# make a template with placeholders
|
# make a template with placeholders
|
||||||
template_text = { name, text, outPath }:
|
template_text = {
|
||||||
|
name,
|
||||||
|
text,
|
||||||
|
outPath,
|
||||||
|
owner ? "root",
|
||||||
|
group ? "",
|
||||||
|
mode ? "0400",
|
||||||
|
}:
|
||||||
pkgs.runCommand name {
|
pkgs.runCommand name {
|
||||||
textBeforeTemplate = text;
|
textBeforeTemplate = text;
|
||||||
script = ''
|
script = ''
|
||||||
|
@ -20,5 +27,7 @@
|
||||||
cp $textBeforeTemplatePath $out/template
|
cp $textBeforeTemplatePath $out/template
|
||||||
cp $scriptPath $out/bin/${name}
|
cp $scriptPath $out/bin/${name}
|
||||||
chmod +x $out/bin/${name}
|
chmod +x $out/bin/${name}
|
||||||
|
chown ${owner}:${group} $out/bin/${name}
|
||||||
|
chmod ${mode} $out/bin/${name}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue