diff options
Diffstat (limited to 'hosts/poweredge')
| -rw-r--r-- | hosts/poweredge/configuration.nix | 12 | ||||
| -rw-r--r-- | hosts/poweredge/immich.nix | 80 |
2 files changed, 72 insertions, 20 deletions
diff --git a/hosts/poweredge/configuration.nix b/hosts/poweredge/configuration.nix index 3935daf..40803bf 100644 --- a/hosts/poweredge/configuration.nix +++ b/hosts/poweredge/configuration.nix @@ -11,6 +11,9 @@ #./notification-mailer.nix # TODO move some of this stuff to archetype ]; + # Allow unfree packages for nvidia/cuda + nixpkgs.config.allowUnfree = true; + # Setup bootloader boot._loader.enable = true; @@ -22,6 +25,7 @@ home.users.timmy.enable = true; }; zfs.enable = true; + cuda.enable = true; }; }; @@ -30,8 +34,12 @@ # Enable nvidia hardware.nvidia = { - open = false; # Need for NVENC - package = config.boot.kernelPackages.nvidiaPackages.stable; + modesetting.enable = true; # Required + nvidiaSettings = false; # Don't need gui + open = false; + package = config.boot.kernelPackages.nvidiaPackages.legacy_580; # Support for P600 + powerManagement.enable = false; # Can cause bugs + powerManagement.finegrained = false; # Only works on turing and newer }; # Enable user timmy 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"; }; }; |
