All nividia drivers crash or do not work

That driver is affected by some pretty serious recent CVEs, if you’re going to stick to a manual definition make sure to update whenever nvidia release new drivers (and also right now): Security Bulletin: NVIDIA GPU Display Driver - June 2024 | NVIDIA

Phoronix’ nvidia section is a good RSS feed to follow if you want to know when there are new driver versions.

Don’t use https://nixos.wiki, it’s outdated, poorly maintained and often wrong to begin with - we have an official wiki nowadays: NixOS Wiki - NixOS Wiki. The configuration you copied likely just incidentally also switched to a driver unaffected by whatever bug causes this rather than being a real “fix”.

Give this config a shot:

hardware.nvidia = {
  package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
    # This is the latest driver with the CVE patches + explicit sync
    version = "555.52.04";
    sha256_64bit = "sha256-nVOubb7zKulXhux9AruUTVBQwccFFuYGWrU1ZiakRAI=";
    sha256_aarch64 = "sha256-Kt60kTTO3mli66De2d1CAoE3wr0yUbBe7eqCIrYHcWk=";
    openSha256 = "sha256-wDimW8/rJlmwr1zQz8+b1uvxxxbOf3Bpk060lfLKuy0=";
    settingsSha256 = "sha256-PMh5efbSEq7iqEMBr2+VGQYkBG73TGUh6FuDHZhmwHk=";
    persistencedSha256 = "sha256-KAYIvPjUVilQQcD04h163MHmKcQrn2a8oaXujL2Bxro=";
  };

  # Modesetting is required for various things, you should almost never
  # run non-modesetting drivers these days
  modesetting.enable = true;
  # Power management is required to get nvidia GPUs to behave on
  # suspend, due to firmware bugs. Aren't nvidia great?
  powerManagement.enable = true;
  # powerManagement.finegrained only makes sense if you have a multi-gpu setup
  # nvidiaSettings is enabled by default anyway
  # The open driver is recommended even by nvidia these days
  open = true;
};

# Without this you won't be using nvidia's semi-proprietary driver,
# but the very slow nouveau
services.xserver.videoDrivers = ["nvidia"];

Can you also run sudo nix-channel --update as well as give us the output of sudo nix-channel --list? If your nixpkgs is outdated, that will explain a lot of these issues.

4 Likes