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