Hello, I am relatively new to nixos. I have been using it for a few months.
My computer has an nvidia GTX 980, and I followed this guide https://nixos.wiki/wiki/Nvidia?__cf_chl_f_tk=eigtlMfFkZFxQT7iuPsQga_NmCnZXU4wkeaCEAyEwNw-1782954335-1.0.1.1-LDIGX9c2pS2aOm1jz2y.28L1mqZYw6T7WAyIM4Rq6p0 in 25.11 to get my card working. None of the options for legacy driver seemed to be able to build, so I commented out the final line that specified the driver to use. It seemed to be able to select the correct driver when I rebuilt it (legacy_580), but if I manually entered legacy_580, the build would fail due to a âmissing dependency.â When I tried to upgrade to 26.05, this problem reappeared, although I was able to rebuild-switch the system. However, upon reboot, the graphics driver failed to load and I was stuck in text only. I tried to manually put in the correct driver, but same as before, it could not rebuild the system if I manually specified the driver. None of the options listed in the link above work. I tried switching between open and closed drivers as well.
Can you share the full configuration youâve ended up with? Itâs way easier to tell you which options to change than play whack-a-mole with what you may or may not have picked up from the internet.
Itâd also be nice to know:
Which DE/WM you use
Whether you use its wayland session, if it has a choice
Whether you also have an iGPU
Whether you care for using said iGPU
The nvidia situation is honestly awful. Pretty much all documentation youâll find is just the latest iteration of a cargo cult, almost nobody actually reads or understands the upstream nvidia documentation. Even if you find something âcorrectâ, your desired hardware/software will probably differ enough that whatever they did doesnât apply to your use case, because nvidia make awful drivers. Hell, Iâd argue you should not even use the NixOS module, but I can at least help you work around its quirks if you tell me what youâre working with.
Sorry for the lack of info. Iâm using KDE with wayland. I also have the option to use X11, but I mainly use wayland. My friend was helping me sort through some of the info, and it seems like up to this point Iâve been using the generic version of the nvidia driver (580.142), although strangely, now after trying to rebuild into 26.05, my old config file with 25.11 can no longer rebuild with the generic driver.
I do not care about the integrated graphics. I donât quite know why it canât rebuild now since the computer is currently working and I can even open games with it, but if I try to rebuild it fails.
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ânixos-helpâ).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Denver";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
# jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
# media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with âpasswdâ.
users.users.zach = {
isNormalUser = true;
description = "zach";
extraGroups = [ "networkmanager" "wheel" "dialout" ];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
};
#Enable NIX flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
#ENABLE GIT
programs.git.enable = true;
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
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 = false;
# 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.legacy_535;
};
nixpkgs.config.nvidia.acceptLicense = true;
#enable steam
programs.steam.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
(python3.withPackages (python-pkgs: with python-pkgs; [
pip
]))
pkgs.krita
pkgs.steam
pkgs.vlc
pkgs.libreoffice
pkgs.element-web
pkgs.discord
pkgs.geeqie
pkgs.kicad
pkgs.obs-studio
pkgs.openscad
pkgs.mumble
pkgs.bluez
pkgs.element-desktop
pkgs.keepass
pkgs.dosbox-x
pkgs.feh
pkgs.hyprland
pkgs.mullvad-vpn
pkgs.tinyxxd
pkgs.photoqt
pkgs.game-devices-udev-rules
pkgs.minicom
pkgs.arduino-ide
pkgs.dasm
#pkgs.libvibrant
#pkgs.vibrantlinux
pkgs.thunderbird
pkgs.diskscan
];
fonts.packages = with pkgs; [ #add fonts here.
komika-fonts
];
services = {
udev = {
packages = with pkgs; [
game-devices-udev-rules
];
};
};
services.mullvad-vpn.enable = true;
#nvidia attempt 2
# services.xserver.videoDrivers = [ "nvidia" ];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
# Shows battery charge of connected devices on supported
# Bluetooth adapters. Defaults to 'false'.
Experimental = true;
# When enabled other devices can connect faster to us, however
# the tradeoff is increased power consumption. Defaults to
# 'false'.
FastConnectable = false;
};
Policy = {
AutoEnable = true;
};
};
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Itâs perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.11"; # Did you read the comment?
}```
I now had time to look at your config. First of all, you were reading the outdated community wiki, the official wiki is at wiki.nixos.org: NVIDIA - Official NixOS Wiki . Unfortunately the owner is uncooperative and the domain still scores high in search engines, so the confusion canât be easily fixed.
The official wiki correctly shows which driver package you need to use, but there also is a shorter version now through the branch option:
hardware.nvidia.branch = "legacy_580";
With this driver, your system should build and run correctly.
Not quite. The kernel version will get in the way, so the build will fail. Even if that was resolved, it might still be stuck using an iGPU, and sleep wonât work.
The configuration as-is is very broken, as are all nvidia configurations I see on this discourse. If youâre not telling a newbie to completely delete everything nvidia-related youâre probably doing it wrong. Please donât help spread the cargo cult.
So letâs do that! Firstly, delete this line:
If you use the latest kernel, you will attempt to use nvidia drivers that werenât designed for it with it. Since the nvidia driver is a kernel module, and it is hence part of the kernel code and has full control over everything, this can lead to anything from simple build failures to spontaneously combusting hardware.
If you use the nvidia driver, just stick to LTS kernels.
Next up, delete the entire hardware.nvidia block, and replace it with:
{
hardware.nvidia = {
# GTX 980
branch = "legacy_580";
open = false;
# Store full graphics memory on suspend
powerManagement.enable = true;
};
}
⌠and nothing else.
Finally:
Does this mean you have an iGPU, but donât want to use it? If so, weâll have to do more work, because as-is plasma will likely use your iGPU by default.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ânixos-helpâ).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Denver";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
# jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
# media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with âpasswdâ.
users.users.zach = {
isNormalUser = true;
description = "zach";
extraGroups = [ "networkmanager" "wheel" "dialout" ];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
};
#Enable NIX flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
#ENABLE GIT
programs.git.enable = true;
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
#gtx980
nvidia.branch = "legacy_580";
open = false;
# Store full graphics memory on suspend
pwoerManagement.enable = true;
};
nixpkgs.config.nvidia.acceptLicense = true;
#enable steam
programs.steam.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
(python3.withPackages (python-pkgs: with python-pkgs; [
pip
]))
pkgs.krita
pkgs.steam
pkgs.vlc
pkgs.libreoffice
pkgs.element-web
pkgs.discord
pkgs.geeqie
pkgs.kicad
pkgs.obs-studio
pkgs.openscad
pkgs.mumble
pkgs.bluez
pkgs.element-desktop
pkgs.keepass
pkgs.dosbox-x
pkgs.feh
pkgs.hyprland
pkgs.mullvad-vpn
pkgs.tinyxxd
pkgs.photoqt
pkgs.game-devices-udev-rules
pkgs.minicom
pkgs.arduino-ide
pkgs.dasm
#pkgs.libvibrant
#pkgs.vibrantlinux
pkgs.thunderbird
pkgs.diskscan
];
fonts.packages = with pkgs; [ #add fonts here.
komika-fonts
];
services = {
udev = {
packages = with pkgs; [
game-devices-udev-rules
];
};
};
services.mullvad-vpn.enable = true;
#nvidia attempt 2
# services.xserver.videoDrivers = [ "nvidia" ];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
# Shows battery charge of connected devices on supported
# Bluetooth adapters. Defaults to 'false'.
Experimental = true;
# When enabled other devices can connect faster to us, however
# the tradeoff is increased power consumption. Defaults to
# 'false'.
FastConnectable = false;
};
Policy = {
AutoEnable = true;
};
};
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Itâs perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.11"; # Did you read the comment?
}
Now Iâm getting this error:
[zach@nixos:~]$ sudo nixos-rebuild switch
error:
⌠while evaluating the attribute 'config'
at /nix/store/l7wvb6rqjjxidjdk9yv9p1a075lvjhq9-nixos-25.11/nixos/lib/modules.nix:361:9:
360| options = checked options;
361| config = checked (removeAttrs config [ "_module" ]);
| ^
362| _module = checked (config._module);
⌠while calling the 'seq' builtin
at /nix/store/l7wvb6rqjjxidjdk9yv9p1a075lvjhq9-nixos-25.11/nixos/lib/modules.nix:361:18:
360| options = checked options;
361| config = checked (removeAttrs config [ "_module" ]);
| ^
362| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: The option `hardware.nvidia.nvidia' does not exist. Definition values:
- In `/home/zach/git/configuration.nix':
{
branch = "legacy_580";
}
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.nixos-rebuild --no-out-link' returned non-zero exit status 1.```
Okay! It seems to be working now. I am able to rebuild the configuration.nix file and I quickly booted up a game that would not run well on integrated graphics and it seems to be running as expected. My computer is a desktop, so I imagine a laptop might have more issues with the integrated graphics.
This is the configuration.nix file that worked:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ânixos-helpâ).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Denver";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
# jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
# media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with âpasswdâ.
users.users.zach = {
isNormalUser = true;
description = "zach";
extraGroups = [ "networkmanager" "wheel" "dialout" ];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
};
#Enable NIX flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
#ENABLE GIT
programs.git.enable = true;
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
#gtx980
branch = "legacy_580";
open = false;
# Store full graphics memory on suspend
powerManagement.enable = true;
};
nixpkgs.config.nvidia.acceptLicense = true;
#enable steam
programs.steam.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
(python3.withPackages (python-pkgs: with python-pkgs; [
pip
]))
pkgs.krita
pkgs.steam
pkgs.vlc
pkgs.libreoffice
pkgs.element-web
pkgs.discord
pkgs.geeqie
pkgs.kicad
pkgs.obs-studio
pkgs.openscad
pkgs.mumble
pkgs.bluez
pkgs.element-desktop
pkgs.keepass
pkgs.dosbox-x
pkgs.feh
pkgs.hyprland
pkgs.mullvad-vpn
pkgs.tinyxxd
pkgs.photoqt
pkgs.game-devices-udev-rules
pkgs.minicom
pkgs.arduino-ide
pkgs.dasm
#pkgs.libvibrant
#pkgs.vibrantlinux
pkgs.thunderbird
pkgs.diskscan
];
fonts.packages = with pkgs; [ #add fonts here.
komika-fonts
];
services = {
udev = {
packages = with pkgs; [
game-devices-udev-rules
];
};
};
services.mullvad-vpn.enable = true;
#nvidia attempt 2
# services.xserver.videoDrivers = [ "nvidia" ];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
# Shows battery charge of connected devices on supported
# Bluetooth adapters. Defaults to 'false'.
Experimental = true;
# When enabled other devices can connect faster to us, however
# the tradeoff is increased power consumption. Defaults to
# 'false'.
FastConnectable = false;
};
Policy = {
AutoEnable = true;
};
};
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Itâs perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.11"; # Did you read the comment?
}
A better way to verify is to run nvidia-smi and see which applications run on your dGPU.
Plasma has auto-detection that automatically offloads intensive applications, but the heuristics might not always work, and depending on how the displays are hooked up you might still be running the DE on your iGPU and pay a penalty because your GPUs have to hand over memory. Plus, thereâs always the chance firmware chooses a different GPU one day for some reason.
Itâd be pretty simple to make the selection permanent via configuration. Or you can even check if you can disable the iGPU in BIOS.