cmd/sharefs: create directory as root

This optional behaviour is required on NixOS as it is otherwise impossible to set this up: systemd.mounts breaks startup order somehow even though my unit looks identical to generated ones, fileSystems does not support any kind of initialisation or ordering other than against other mount points.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-12-27 22:09:55 +09:00
parent ef1ebf12d9
commit e7982b4ee9
3 changed files with 36 additions and 5 deletions

View File

@@ -73,11 +73,7 @@ in
NoNewPrivileges = true;
};
script = ''
${pkgs.coreutils}/bin/install \
-dm0700 \
-o ${cfg.sharefs.user} \
-g ${cfg.sharefs.group} \
${cfg.sharefs.source} ${cfg.sharefs.name}
${pkgs.coreutils}/bin/install -dm0 ${cfg.sharefs.name}
exec ${cfg.package}/libexec/sharefs -f \
-o ${
@@ -91,6 +87,7 @@ in
"setuid=$(id -u ${cfg.sharefs.user})"
"setgid=$(id -g ${cfg.sharefs.group})"
"source=${cfg.sharefs.source}"
"mkdir"
]
} ${cfg.sharefs.name}
'';