NVIDIA gpu requires nomodeset

Hey everyone, I’m new here!

I’m trying to install NixOS on my main computer and, if I go straight for the first item in the grub (?) menu the display gets these graphical problems and all new text is just a random jumble of black and white pixels at the bottom of the screen. To properly be able to boot into the NixOS installation image I need to select the “nomodeset” version, and then it works just fine (apart from the ugly tty resolution). The graphics card in question is a RTX 2060 which work just fine with Arch Linux.

My questions are:

  • Is this behaviour expected for my hardware or would it be considered a bug?
  • Is there a way to work around the nomodeset parameter?

If it work well on arch, it’s probably a problem in the install image. Maybe it’s because you use the proprietary driver on arch, and the install image doesn’t include them. If you install nixos, you should read the wiki page about it : https://nixos.wiki/wiki/Nvidia .
You can check the driver version with (on the install image) nix-shell -p glxinfo --command glxinfo | less (there should be some interesing entry like OpenGL vendor string or OpenGL core profile version string. You can then install glxinfo in arch and try the glxinfo | less and compare the result from both).

I guess that mode setting is supposed to work (since it works on other distributions). However, after booting the install CD with nomodeset, you can switch to the proprietary NVIDIA driver. First, edit /etc/nixos/configuration.nix, adding:

nixpkgs.config.allowUnfree = true;
services.xserver.videoDrivers = [ "nvidia" ];

Then run nixos-rebuild switch. Afterwards, the NVIDIA driver is available in the live environment. You can then start KDE/GNOME (depending on the ISO that you use) with:

systemctl restart display-manager.service

Of course, if you want to use the NVIDIA driver on your installed system, you should add the lines above to the generated NixOS configuration (/mnt/etc/nixos/configuration.nix).

1 Like

Makes sense. I accidentally forgot to install the NVidia driver when installing NixOS, and then I got the same graphical glitches when trying to boot for the first time. It does indeed look like the driver is missing in the installation image.

Thanks for the help! :slight_smile:

So the solution for the graphical issues is to install the correct drivers, no real surprise there.

Regarding the nomodeset, my understanding is that kernel mode setting is setting the correct display resolution when starting the kernel, instead of leaving it entirely to xorg (according to this arch wiki article). I assume this is what makes the arch tty find the correct resolution on arch linux, but it seems like that isn’t the case with NixOS. Is there a parameter somewhere to enable kms, or is it not supported in NixOS? When trying to set up a NixOS installation from the tty, the poor resolution isn’t really comfortable.

After a bit of reading on the arch wiki I found that all drivers but nvidia automatically enables modesetting. To enable it with a nvidia driver, you could add nvidia-drm.modeset=1 to the kernel parameters. I’ll test this out later today

Once again, thanks for the help!

Turns out there is an expression to do just that: hardware.nvidia.modesetting.enable. However neither the kernel parameter nor the nix expression seem to work. The resolution is still the same.