Files
nixos/modules/server/immich.nix
T
oqyude 69691f96d1 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].
2026-10-25 02:09:40 +03:00

46 lines
1.0 KiB
Nix

{
config,
inputs,
lib,
pkgs,
xlib,
...
}:
{
services = {
immich = {
enable = true;
port = 2283;
host = "0.0.0.0";
openFirewall = true;
accelerationDevices = null;
machine-learning.enable = true;
mediaLocation = "${xlib.dirs.services-mnt-folder}/immich";
};
};
systemd = {
tmpfiles.rules = [
(xlib.helpers.mkTmpfile "z" config.services.immich.mediaLocation "0755" "immich" "immich")
];
# 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 = [
"video"
"render"
];
environment = {
systemPackages = with pkgs; [
immich-cli
];
};
}