summaryrefslogtreecommitdiff
path: root/hosts/poweredge/immich.nix
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2026-06-17 17:24:26 -0500
committerTim Keller <tjk@tjkeller.xyz>2026-06-17 17:24:26 -0500
commit20256167c33db9c6b762a5bcf0b6678de45653d0 (patch)
tree63c6fe9e9e9ef36d0437939f4b65a725d5ca831f /hosts/poweredge/immich.nix
parentaf63e346ff5542559dc507b0a901a4d8b370d4d3 (diff)
downloadnixos-20256167c33db9c6b762a5bcf0b6678de45653d0.tar.xz
nixos-20256167c33db9c6b762a5bcf0b6678de45653d0.zip
cuda support and immich cuda support
Diffstat (limited to 'hosts/poweredge/immich.nix')
-rw-r--r--hosts/poweredge/immich.nix80
1 files changed, 62 insertions, 18 deletions
diff --git a/hosts/poweredge/immich.nix b/hosts/poweredge/immich.nix
index 51d7885..24b32c2 100644
--- a/hosts/poweredge/immich.nix
+++ b/hosts/poweredge/immich.nix
@@ -1,4 +1,6 @@
-{
+{ pkgs, ... }: let
+ onnxruntimeCuda = pkgs.onnxruntime.override { cudaSupport = true; };
+in {
containers.immich = {
autoStart = true;
privateNetwork = true;
@@ -14,30 +16,55 @@
};
# GPU
- #allowedDevices = [
- # { node = "/dev/dri/card1"; modifier = "rw"; }
- # { node = "/dev/dri/renderD128"; modifier = "rw"; }
- #];
-
- #bindMounts = {
- # "/dev/dri/card1" = {
- # hostPath = "/dev/dri/card1";
- # isReadOnly = false;
- # };
- # "/dev/dri/renderD128" = {
- # hostPath = "/dev/dri/renderD128";
- # isReadOnly = false;
- # };
- #};
+ allowedDevices = [
+ { node = "/dev/nvidia0"; modifier = "rw"; }
+ { node = "/dev/nvidiactl"; modifier = "rw"; }
+ { node = "/dev/nvidia-uvm"; modifier = "rw"; }
+ { node = "/dev/nvidia-uvm-tools"; modifier = "rw"; }
+ { node = "/dev/nvidia-modeset"; modifier = "rw"; }
+ ];
+
+ bindMounts = {
+ # NVENC/NVDEC - video transcoding
+ "/dev/nvidia0" = { hostPath = "/dev/nvidia0"; isReadOnly = false; };
+ "/dev/nvidiactl" = { hostPath = "/dev/nvidiactl"; isReadOnly = false; };
+ # CUDA - required for ML inference
+ "/dev/nvidia-uvm" = { hostPath = "/dev/nvidia-uvm"; isReadOnly = false; };
+ "/dev/nvidia-uvm-tools" = { hostPath = "/dev/nvidia-uvm-tools"; isReadOnly = false; };
+ # Modeset - needed by some driver paths
+ "/dev/nvidia-modeset" = { hostPath = "/dev/nvidia-modeset"; isReadOnly = false; };
+ };
config = { lib, pkgs, config, ... }: {
# Network
networking.interfaces.eth0.useDHCP = true;
networking.firewall.allowedTCPPorts = [ 80 ]; # Caddy
+ # Configure nixpkgs for nvidia/cuda
+ nixpkgs.config.allowUnfree = true;
+ nixpkgs.config.cudaSupport = true;
+
# Immich
- services.immich.enable = true;
- environment.systemPackages = with pkgs; [ immich immich-cli ];
+ services.immich = {
+ enable = true;
+ accelerationDevices = [
+ "/dev/nvidia0"
+ "/dev/nvidiactl"
+ "/dev/nvidia-uvm"
+ "/dev/nvidia-uvm-tools"
+ "/dev/nvidia-modeset"
+ ];
+
+ # Tell immich-server to use NVENC for transcoding
+ environment = {
+ NVIDIA_VISIBLE_DEVICES = "all";
+ NVIDIA_DRIVER_CAPABILITIES = "compute,video,utility";
+ };
+
+ # Enable the ML microservice with CUDA
+ machine-learning.enable = true;
+ };
+ #environment.systemPackages = with pkgs; [ immich immich-cli ];
# Reverse proxy
services.caddy = {
@@ -47,6 +74,23 @@
'';
};
+ # NVIDIA
+ services.xserver.videoDrivers = [ "nvidia" ]; # xserver.videoDrivers does not imply X
+ hardware.graphics.enable = true;
+ hardware.nvidia = {
+ modesetting.enable = true; # Required
+ nvidiaSettings = false; # Don't need gui
+ open = false;
+ package = config.boot.kernelPackages.nvidiaPackages.legacy_580; # Must match host
+ };
+
+ # Packages
+ environment.systemPackages = with pkgs; [
+ immich
+ immich-cli
+ config.hardware.nvidia.package # nvidia-smi
+ ];
+
system.stateVersion = "25.11";
};
};