{ lib, config, pkgs, ... }: { # Configure nixpkgs for nvidia/cuda nixpkgs.config = { #cudaSupport = true; # Compile CUDA kernels only for the P100 (compute capability 6.0). # The container reuses the host's pkgs, so this has to be set here. cudaCapabilities = [ "6.0" ]; allowUnfreePredicate = pkg: pkgs._cuda.lib.allowUnfreeCudaPredicate pkg || builtins.elem (lib.getName pkg) [ "nvidia-x11" "nvidia-kernel-modules" "open-webui" ]; }; # 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; # Support for P600 powerManagement.enable = false; # Can cause bugs powerManagement.finegrained = false; # Only works on turing and newer }; # Packages environment.systemPackages = with pkgs; [ config.hardware.nvidia.package # nvidia-smi nvtopPackages.nvidia ]; }