diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-21 15:13:45 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-21 15:13:45 +0000 |
| commit | 81ef29e8589ac4e10b6f67b4ab4049645f05c020 (patch) | |
| tree | 25b21be94e25fbdde852ec700295c8b77c696d62 /nix | |
| parent | 6c3c93752e9ee8da7f16fbeda70f9eb7a0ca8eb0 (diff) | |
fix(nix): explicitly create parent directories for dataDir in tmpfiles
The tmpfiles.rules now explicitly creates the parent directory of dataDir
with root:root ownership and 0755 permissions before creating the
service-owned directories. This ensures the directory hierarchy exists
even if parent directories are missing.
While systemd-tmpfiles should create parent directories automatically,
this makes the behavior explicit and ensures proper permissions on the
immediate parent directory.
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/module.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nix/module.nix b/nix/module.nix index 564259e..e192f95 100644 --- a/nix/module.nix +++ b/nix/module.nix | |||
| @@ -459,7 +459,12 @@ in { | |||
| 459 | 459 | ||
| 460 | # Create data directories with proper ownership using tmpfiles | 460 | # Create data directories with proper ownership using tmpfiles |
| 461 | # This runs as root before the service starts | 461 | # This runs as root before the service starts |
| 462 | # Note: Parent directories are created with root:root ownership (mode 0755) | ||
| 463 | # to ensure the path exists, while dataDir itself gets proper service ownership | ||
| 462 | systemd.tmpfiles.rules = flatten (mapAttrsToList (name: cfg: [ | 464 | systemd.tmpfiles.rules = flatten (mapAttrsToList (name: cfg: [ |
| 465 | # Create parent directories if they don't exist (root-owned, standard perms) | ||
| 466 | "d ${dirOf cfg.dataDir} 0755 root root -" | ||
| 467 | # Create service-owned directories | ||
| 463 | "d ${cfg.dataDir} 0750 ${cfg.user} ${cfg.group} -" | 468 | "d ${cfg.dataDir} 0750 ${cfg.user} ${cfg.group} -" |
| 464 | "d ${cfg.dataDir}/git 0750 ${cfg.user} ${cfg.group} -" | 469 | "d ${cfg.dataDir}/git 0750 ${cfg.user} ${cfg.group} -" |
| 465 | "d ${cfg.dataDir}/relay 0750 ${cfg.user} ${cfg.group} -" | 470 | "d ${cfg.dataDir}/relay 0750 ${cfg.user} ${cfg.group} -" |