Best practice for referencing cudatoolkit

If I understand correctly, the CUDA toolkit is available under the name cudaPackages.cudatoolkit_11 (or similar, depending on version) for NixOS 21.11, but as cudatoolkit in unstable. Is there a best practice for referencing it so that my Nix files work in both?

Thanks and sorry if this is an obvious question; I’m new to Nix.

Note there is a new section in the Nixpkgs manual on CUDA.

For the time being cudatoolkit is still available as top-level attribute but it may disappear. In time, it is preferable that consumers of cudatoolkit migrate to the redist packages. The redist packages are the cudatoolkit split into smaller packages. They are also part of cudaPackages.

So, to answer your question, for now you can keep using just cudatoolkit but in time, you’ll likely need to try both.


Thanks. Have the redist packages been made available yet? I wouldn’t mind trying them out but I don’t currently see anything under a search for cudaPackages.

Yes, they are available, however I see now I forgot to add recurseIntoAttrs so they’re not visible directly.


This has been fixed now on master.