From c397110901d896fa8f7d012136eed54fbeaf34e4 Mon Sep 17 00:00:00 2001 From: Torsten Trautwein Date: Fri, 24 Jan 2025 09:04:40 +0100 Subject: [PATCH] nixos/immich: Add accelerationDevices configuration option This allows immich to utilize devices for hardware accelerated video transcoding. --- nixos/modules/services/web-apps/immich.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/web-apps/immich.nix b/nixos/modules/services/web-apps/immich.nix index fa80c47305ba..cc7d5ff6f39e 100644 --- a/nixos/modules/services/web-apps/immich.nix +++ b/nixos/modules/services/web-apps/immich.nix @@ -20,7 +20,8 @@ let NoNewPrivileges = true; PrivateUsers = true; PrivateTmp = true; - PrivateDevices = true; + PrivateDevices = cfg.accelerationDevices == [ ]; + DeviceAllow = mkIf (cfg.accelerationDevices != null) cfg.accelerationDevices; PrivateMounts = true; ProtectClock = true; ProtectControlGroups = true; @@ -161,6 +162,17 @@ in }; }; + accelerationDevices = mkOption { + type = types.nullOr (types.listOf types.str); + default = [ ]; + example = [ "/dev/dri/renderD128" ]; + description = '' + A list of device paths to hardware acceleration devices that immich should + have access to. This is useful when transcoding media files. + The special value `[ ]` will disallow all devices using `PrivateDevices`. `null` will give access to all devices. + ''; + }; + database = { enable = mkEnableOption "the postgresql database for use with immich. See {option}`services.postgresql`"