Just landed back from NixCon, somehow every year is even more beautiful.
I know that many of us in the Nix community dreamed of a world where Nix’s virtues of reproducibility, determinism, and portability would extend to CUDA projects.
We knew this was possible. We also knew it would require alignment and approval with NVIDIA.
The team at Flox has been working with NVIDIA over the past months on an agreement to redistribute CUDA Toolkit packages, in partnership with the NixOS Foundation, Nix Steering Committee (SC), Nix CUDA team, and a bunch of other teams and individuals across the community!
As of today, you can pull prebuilt, prepatched CUDA packages (including the CUDA Toolkit, PyTorch, TensorFlow, TensorRT, OpenCV, ffmpeg, and more) from Flox’s binary cache. These are unmodified builds from canonical Nixpkgs definitions, ready to use as soon as they’re downloaded from cache.flox.dev. CUDA packages that once took hours to build can be available for use basically as soon as they’re done downloading.
There are a few nuances to understand, though, so keep reading ![]()
How to Use
Flox is opening its binary cache to the Nix community, so users of both the Nix package manager and NixOS will be able to pull and run prebuilt, prepatched user-space CUDA packages. Users of NixOS can get prepatched NVIDIA CUDA display drivers, too.
You just need to add cache.flox.dev to Nix’s/NixOS’s list of extra-substituters.
With extra-substituters, Nix always checks cache.nixos.org first, and only uses Flox’s cache for packages not found upstream. For the Nix package manager, extra-substituters lives in nix.conf; on NixOS it lives in configuration.nix. Add the following to the appropriate config file:
extra-trusted-substituters = https://cache.flox.dev
extra-trusted-public-keys = flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=
There are some nuances here. If you’re declaring specific versions of upstream CUDA dependencies, or if you’re tracking a moving channel (like nixos-unstable), you’ll need to take extra steps. The Flox blog has a helpful rundown on how this works and what you need to do.
This is just the first phase, released as early access. Over the next few weeks we’ll be shipping improvements. Your feedback—especially teams using CUDA for commercial purposes—will guide what we do next. If you run into problems, have questions, or want to see something specific, reach out and let us know.
It Takes a Community
This is the culmination of years of selfless work by the Nix CUDA team, non-stop encouragement from users of Nix, and months of discussion with leadership at NVIDIA. It’s finally happened: NVIDIA is recognizing Nix as one of the preferred paths for CUDA!
NVIDIA’s recognition makes Nix an officially supported path for CUDA, and the partnership between NVIDIA and Flox together with the NixOS Foundation and SC means that it’s now available to Nix users everywhere. Flox commits to maintaining this partnership, funding the required infrastructure, and doing the work necessary to maintain the binary cache.
Link to NVIDIA announcement - Developers Can Now Get CUDA Directly from Their Favorite Third-Party Platforms | NVIDIA Technical Blog
There’s still a lot more to do, and plenty of ways to be involved. The Nix CUDA team is at the core of this effort and contribution is welcome. If you’re interested in volunteering, supporting or helping to fund the critical work the Nix CUDA team is doing, please reach out directly to them or the SC/Foundation channels.
This is just another step in a Sustainable Nix.
A huge thank you! to everyone who packaged, tested, contributed, supported, advocated and/or pushed for this. And a shout out to NVIDIA for recognizing the critical role Nix plays in how teams build and run CUDA workloads.
Additional big
to @SergeK @ConnorBaker @samuela @Ericson2314 @Infinisil @tomberek @winter @jtojnar @lassulus @ryantrinkle @edef @roberth @ra33it0
All the other folks, just drop me a note if I can add your names!