set file rights

This commit is contained in:
Kiara Grouwstra 2025-08-11 14:43:03 +02:00
parent 88e3fb4496
commit 13fcb19bf9
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU

12
lib.nix
View file

@ -17,7 +17,15 @@ rec {
};
# make a template with placeholders from a text
templateText = { name, text, outPath, translations ? {} }:
templateText = {
name,
text,
outPath,
owner ? "root",
group ? "",
mode ? "0400",
translations ? {},
}:
pkgs.runCommand name {
textBeforeTemplate = text;
script = ''
@ -30,6 +38,8 @@ rec {
cp $textBeforeTemplatePath $out/template
cp $scriptPath $out/bin/${name}
chmod +x $out/bin/${name}
chown ${owner}:${group} $out/bin/${name}
chmod ${mode} $out/bin/${name}
'';
# make a template with placeholders from a file