my nix configs for my servers and desktop
1{ config, lib, pkgs, ... }: 2{ 3 # Enable OpenGL 4 hardware.graphics = { 5 enable = true; 6 }; 7 8 # Load nvidia driver for Xorg and Wayland 9 services.xserver.videoDrivers = ["nvidia"]; 10 11 hardware.nvidia = { 12 13 # Modesetting is required. 14 modesetting.enable = true; 15 16 # Nvidia power management. Experimental, and can cause sleep/suspend to fail. 17 # Enable this if you have graphical corruption issues or application crashes after waking 18 # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead 19 # of just the bare essentials. 20 powerManagement.enable = false; 21 22 # Fine-grained power management. Turns off GPU when not in use. 23 # Experimental and only works on modern Nvidia GPUs (Turing or newer). 24 powerManagement.finegrained = false; 25 26 # Use the NVidia open source kernel module (not to be confused with the 27 # independent third-party "nouveau" open source driver). 28 # Support is limited to the Turing and later architectures. Full list of 29 # supported GPUs is at: 30 # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus 31 # Only available from driver 515.43.04+ 32 open = false; 33 34 # Enable the Nvidia settings menu, 35 # accessible via `nvidia-settings`. 36 nvidiaSettings = true; 37 38 package = config.boot.kernelPackages.nvidiaPackages.stable; 39 }; 40}