How to disable cuda and nvidia on amd laptop

I have a laptop with only amd cpu and amd gpu and nixos-rebuild just failed with the following:

       error: Package ‘cuda12.8-cuda_nvcc-12.8.93’ in /nix/store/df02fsc6x7f1gjhrh2zr0dmpfq5jqwnf-nixos/nixos/pkgs/development/cuda-modules/packages/cuda_nvcc.nix:175 has an unfree license (‘CUDA EULA’), refusing to evaluate.

I have nothing related to cuda or nvidia in my configuration.nix (I only use configuration.nix and not home-manager or similar trash).
hardware.nvidia.package = null; had no effect, hardware.nvidia.enable is no longer an option, and hardware.nvidia.enabled is apparently read-only despite being recognized as an option in configuration.nix and being listed in NixOS Search.

How do I disable cuda and nvidia - the >20 lines of debug info in nixos-rebuild just say to allow unfree packages but I don’t want to let these nvidia packages I’ve never needed back into my build.

In theory this should only happen if you explicitly enable cudaSupport. You must have somehow accidentally done that, though it’s hard to imagine how. From a cursory grep through nixpkgs there are no un-gated uses of cuda, though I might have missed one.

Could you share your config so I don’t have to use my imagination?

There was an unfortunate regression where CUDA packages where inadvertently leaked into Firefox via onnxruntime. This has been fixed on master and should be on nixos-unstable tomorrow.

6 Likes