set file rights

This commit is contained in:
Kiara Grouwstra 2025-08-11 14:43:03 +02:00
parent 437fd19b72
commit 0e9fb00940
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU

11
lib.nix
View file

@ -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}
''; '';
} }