Skip to content

Conversation

@Aietes
Copy link

@Aietes Aietes commented Mar 11, 2025

On certain distros, where the NVIDIA driver is typically installed via the NVIDIA driver repositories, trying to install the driver from the download site will commonly fail with a 404 error, like described in #170 and #124 and #67.

There have been approaches to solve this, e.g. in #184, but this will not work reliably. The key problem is that NVIDIA is not providing consistent versions of their drivers on different distribution channels. For Rocky Linux, and all other RHEL distros, the latest version on the download site differs. e.g. at the time of writing, the latest on downloads .run is 570.124.04, while the .rpm version in the RHEL repository is 570.124.06:

Driver download: https://download.nvidia.com/XFree86/Linux-x86_64/570.124.04/
RHEL repository: https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/nvidia-driver-libs-570.124.06-1.el9.x86_64.rpm

Using a different version, even if it's a small difference in the minor version, does not work in my experience. One could always manually install a driver, but in the case of RHEL it's way better to get the NVIDIA driver installed and updated via the default package manager and update cycle.

To solve this issue, I've created a fork with an additional derivation in nixGL, that gets the driver from the RHEL repository from the .rpm. This works well for me, and should solve the issue for RHEL users. It it would be nice if it could be merged.

To get the driver from the RHEL .rpm instead of the driver download site, simply set driverSource to rhel. Also ensure that enable32bits is changed from its default to false, as at this point I did not include the 32bit version of the driver. Here's an example from my .nix using home-manager:

{
  nixpkgs = {
    overlays = specialArgs.overlays;
    config = { allowUnfree = true; };
  };

  home.packages = with pkgs; [
    (nixgl.override {
      driverSource = "rhel";
      enable32bits = false;
    }).auto.nixGLDefault
    (config.lib.nixGL.wrap ghostty)
  ];

  nixGL = {
   packages = pkgs.nixgl.override {
    driverSource = "rhel";
    enable32bits = false;
   };
   defaultWrapper = "nvidia";
  };

If you face the driver problem and you are on any RHEL distro like Rocky, Fedora, etc., you can use the nixGL overlay from my fork until this is merged:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixgl = {
      url = "github:Aietes/nixGL/rhel";
    };
  };
  ....

Something similar can probably be done for Debian and other distros, using the official NVIDIA driver for a specific distro as the source for nixGL.

Fixes #170 #124 #67

@Aietes
Copy link
Author

Aietes commented Mar 11, 2025

Since it seems that the driver version is consistent across Debian, Fedora and RHEL, at least at this point, pulling the driver from the RHEL repository very likely also works on other distros, pending somebody testing this.

Copy link

@dyfrgi dyfrgi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me as an approach to implementing the idea, but it's strange to me that it's necessary. Are the RHEL repositories more reliable? Have you inquired on the NVidia developer forums about this strange behavior of deleting old versions from the download site? Does the license permit redistribution? If so, we could also consider making our own repository of them.

}
export LD_LIBRARY_PATH=${lib.makeLibraryPath mesa-drivers}:${lib.makeSearchPathOutput "lib" "lib/vdpau" libvdpau}:${glxindirect}/lib:${lib.makeLibraryPath [libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export LIBVA_DRIVERS_PATH=${
lib.makeSearchPathOutput "out" "lib/dri" (mesa-drivers ++ vadrivers)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move the formatting changes here, and elsewhere in the PR, into their own commit?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for those, autoformatting...

@dyfrgi
Copy link

dyfrgi commented Jul 5, 2025

Oh I missed this in my first review, but now that the tests are working could you add a test for this?

@Aietes
Copy link
Author

Aietes commented Jul 10, 2025

I'm short on time right now, but will look into tests when I find time. Do you have a specific testing methodology?

@Aietes
Copy link
Author

Aietes commented Jul 10, 2025

This looks fine to me as an approach to implementing the idea, but it's strange to me that it's necessary. Are the RHEL repositories more reliable? Have you inquired on the NVidia developer forums about this strange behavior of deleting old versions from the download site? Does the license permit redistribution? If so, we could also consider making our own repository of them.

This is needed because the specific driver version used in RHEL rarely (never) matches a version available in the NVIDIA repos. People have inquired about this many times, but the issue remains. This approach guarantees nixGL can find the exact version required by an RHEL based distro (Rocky, Fedora, RHEL, Debian), which are widely used.

@dyfrgi
Copy link

dyfrgi commented Jul 10, 2025

I don't have a testing method, no. The testing in this project needs some work in general. There's all.nix and Test.hs today, neither of which quite fits. I think it's fine to merge this with only manual testing, especially since I don't really have any suggestions on where to hang new tests for this.

This is needed because the specific driver version used in RHEL rarely (never) matches a version available in the NVIDIA repos

Ohhh, I think I misunderstood what you meant by "consistent version across distribution channels" in the README.md change. I thought you meant that it was the same number but the files were meaningfully different. If they're always different versions, I wonder if they could be merged into one auto detection lists in the future?

With the formatting changes stripped out, I think this would be good to merge. I'd like to see either an automated test or another report from a user about this working for them, including the update script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

404 error with latest Nvidia drivers

2 participants