fix(systemd): move the storage guard into [Unit] (T4/T52)

mkStorageGuard returned a serviceConfig fragment, so ConditionPathIsMountPoint
landed in [Service] where systemd ignores it - the guard was dead on 13 units.

- helper now returns a unitConfig fragment ([Unit]); RequiresMountsFor still
  intentionally absent
- consumers re-pointed at the real unit names: samba-smbd, phpfpm-nextcloud,
  immich-server, podman-3xui_app, podman-taperotation-{backend,frontend};
  the old serviceConfig keys silently rendered three empty phantom units
- vds excluded: otreca has no /home/oqyude/External and a live condition would
  skip podman-3xui_app and kill the 3x-ui panel at pubray1.zeroq.su

Verified: sapphira and otreca toplevel builds exit 0; all 13 units carry the
condition under [Unit] (line 3), zero occurrences under [Service].
This commit is contained in:
oqyude committed 2026-10-25 02:09:40 +03:00
1 parent 8079536db2
commit 69691f96d1
13 files changed
+102 -32

No files matched your search

+5 -1
View File
@@ -84,7 +84,11 @@ in
systemd = {
services = {
"podman-3xui_app" = {
serviceConfig = xlib.helpers.mkStorageGuard xlib // {
# Guard goes to `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint`
# is a unit-level directive and is ignored by systemd in `[Service]`
# (T4/R1.2).
unitConfig = xlib.helpers.mkStorageGuard xlib;
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
partOf = [ "podman-compose-3x-ui-root.target" ];
+10 -2
View File
@@ -102,7 +102,11 @@ in
systemd = {
services = {
"podman-taperotation-backend" = {
serviceConfig = xlib.helpers.mkStorageGuard xlib // {
# Guard goes to `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint`
# is a unit-level directive and is ignored by systemd in `[Service]`
# (T4/R1.2).
unitConfig = xlib.helpers.mkStorageGuard xlib;
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
after = [ "podman-network-taperotation_default.service" ];
@@ -111,7 +115,11 @@ in
wantedBy = [ "podman-compose-tape-rotation-root.target" ];
};
"podman-taperotation-frontend" = {
serviceConfig = xlib.helpers.mkStorageGuard xlib // {
# Guard goes to `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint`
# is a unit-level directive and is ignored by systemd in `[Service]`
# (T4/R1.2).
unitConfig = xlib.helpers.mkStorageGuard xlib;
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
after = [
+3 -1
View File
@@ -64,7 +64,9 @@ in
"Z"
];
};
services.calibre-web.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services."calibre-web".unitConfig = xlib.helpers.mkStorageGuard xlib;
};
fileSystems = xlib.helpers.mkBindMount {
+3 -1
View File
@@ -35,6 +35,8 @@
user = "gitea";
group = "gitea";
};
services.gitea.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services.gitea.unitConfig = xlib.helpers.mkStorageGuard xlib;
};
}
+3 -1
View File
@@ -30,6 +30,8 @@ in
};
systemd = storage.systemd // {
services.homebox.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services.homebox.unitConfig = xlib.helpers.mkStorageGuard xlib;
};
}
+7 -1
View File
@@ -23,7 +23,13 @@
tmpfiles.rules = [
(xlib.helpers.mkTmpfile "z" config.services.immich.mediaLocation "0755" "immich" "immich")
];
services.immich.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# nixpkgs names the immich backend unit `immich-server`; there is NO unit
# called `immich`. `systemd.services.immich` would render a phantom unit
# with no ExecStart → systemd refuses to start it (ADR-0004).
#
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services."immich-server".unitConfig = xlib.helpers.mkStorageGuard xlib;
};
users.users.immich.extraGroups = [
+3 -1
View File
@@ -30,6 +30,8 @@ in
where = pointDir;
})
];
services.navidrome.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services.navidrome.unitConfig = xlib.helpers.mkStorageGuard xlib;
};
}
+8 -1
View File
@@ -211,7 +211,14 @@ in
tmpfiles.rules = [
(xlib.helpers.mkTmpfile "z" config.services.nextcloud.home "0750" "nextcloud" "nextcloud")
];
services.nextcloud.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# nixpkgs serves nextcloud through the PHP-FPM unit `phpfpm-nextcloud`;
# there is NO unit called `nextcloud`. `systemd.services.nextcloud` would
# render a phantom unit with no ExecStart → systemd refuses to start it
# (ADR-0004).
#
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services."phpfpm-nextcloud".unitConfig = xlib.helpers.mkStorageGuard xlib;
};
environment.systemPackages = [
+3 -1
View File
@@ -24,6 +24,8 @@ in
};
systemd = storage.systemd // {
services.postgresql.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services.postgresql.unitConfig = xlib.helpers.mkStorageGuard xlib;
};
}
+8 -1
View File
@@ -73,6 +73,13 @@ in
};
systemd = storage.systemd // {
services.samba.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# The samba file server is the unit `samba-smbd` (nixpkgs names it that
# way; there is NO unit called `samba`). `systemd.services.samba` would
# render a phantom unit with no ExecStart → systemd refuses to start it
# (ADR-0004).
#
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services."samba-smbd".unitConfig = xlib.helpers.mkStorageGuard xlib;
};
}
+3 -1
View File
@@ -15,5 +15,7 @@
user = "${xlib.device.username}";
};
systemd.services.syncthing.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
systemd.services.syncthing.unitConfig = xlib.helpers.mkStorageGuard xlib;
}
+3 -1
View File
@@ -23,7 +23,9 @@ in
tmpfiles.rules = [
(xlib.helpers.mkTmpfile "z" sourceDir "0755" "nobody" "nogroup")
];
services.uptime-kuma.serviceConfig = xlib.helpers.mkStorageGuard xlib;
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services."uptime-kuma".unitConfig = xlib.helpers.mkStorageGuard xlib;
};
fileSystems = xlib.helpers.mkBindMount {