From 24c7043fa29f2fbd0cb068c44157752fe265282b Mon Sep 17 00:00:00 2001 From: Alexander Wainwright Date: Tue, 16 Dec 2025 12:58:40 +1000 Subject: [PATCH] Add nvidia driver and set kernel version --- hosts/armitage/configuration.nix | 77 +++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/hosts/armitage/configuration.nix b/hosts/armitage/configuration.nix index ce62a2e..ce2b4cc 100644 --- a/hosts/armitage/configuration.nix +++ b/hosts/armitage/configuration.nix @@ -18,10 +18,83 @@ boot.loader.efi.canTouchEfiVariables = true; # Use latest kernel. - boot.kernelPackages = pkgs.linuxPackages_latest; + # boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = pkgs.linuxPackages_6_12; networking.hostName = "armitage"; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + hardware.graphics.enable = true; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia" "displaylink" "modesetting"]; + + boot = { + blacklistedKernelModules = [ "nouveau" ]; + }; + + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + open = true; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + # package = config.boot.kernelPackages.nvidiaPackages.stable; + package = config.boot.kernelPackages.nvidiaPackages.mkDriver { + version = "580.76.05"; + sha256_64bit = "sha256-IZvmNrYJMbAhsujB4O/4hzY8cx+KlAyqh7zAVNBdl/0="; + sha256_aarch64 = "sha256-NL2DswzVWQQMVM092NmfImqKbTk9VRgLL8xf4QEvGAQ="; + openSha256 = "sha256-xEPJ9nskN1kISnSbfBigVaO6Mw03wyHebqQOQmUg/eQ="; + settingsSha256 = "sha256-ll7HD7dVPHKUyp5+zvLeNqAb6hCpxfwuSyi+SAXapoQ="; + persistencedSha256 = "sha256-bs3bUi8LgBu05uTzpn2ugcNYgR5rzWEPaTlgm0TIpHY="; + }; + + prime = { + sync.enable = true; + + amdgpuBusId = "PCI:0:65:0"; + nvidiaBusId = "PCI:0:64:0"; + }; + }; + + # packages + environment.systemPackages = with pkgs; [ + displaylink + libreoffice + ]; + + # Already detected directories + programs = { + direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + }; + + # # display link drivers + # systemd.services.dlm.wantedBy = [ "multi-user.target" ]; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions