Skip to content

Add huggingface and nix-community nix caches to flakes #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

osbm
Copy link

@osbm osbm commented Jul 2, 2025

The cuda-maintainers cache is moved into the nix-community cache (more info: https://github.com/SomeoneSerge/nixpkgs-cuda-ci )

The nix-community and huggingface caches really speed up the build process because only the torch without cuda is cached at the default cache.nixos.org. The torch and some other python packages that uses CUDA is cached at nix-community cache.

Otherwise these examples run for hours just to build flake outputs.

"https://huggingface.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
Copy link
Member

@danieldk danieldk Jul 3, 2025

Choose a reason for hiding this comment

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

Thanks for the PR! I don't think we want to add a non-official cache that is not populated by builders that we control. I know that it's driven by people who are part of the NixOS project, but building and caching everything that is needed ourselves is not a big hassle.

Outside that, this would not give many cache hits anyway, we use our own Torch derivations and override a bunch of packages, so the only thing that ends up being retrieved from the cache are the CUDA toolkit packages (which are cheap to build anyway).

As for adding the Hugging Face cache, we experimented with that before, but it gave annoying interactive prompts for people who have already set up the HF cache:

do you want to allow configuration setting 'extra-substituters' to be set to 'https://huggingface.cachix.org' (y/N)?

Another issue is that this would percolate to third-party kernels and if we ever want to change to our own hosted cache or revoke the signature, all those repositories will have to be updated. So I think we'd prefer people to use cachix use huggingface once.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for your reply!!

I understand there are security concerns when it comes to trusting third party caches so i actually agree with you about not adding nix-community cache.

But about that annoying query, if you say yes to that question, it asks if you want to mark that value as trusted permenantly. This could be a better way for the people who dont want to install cachix software to their system. (like me 😁)

I suspect both methods just edit the users' trusted-settings.json file.

Would it be acceptable if i just added the huggingface cache setting to the examples with an explanation up top?

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.

2 participants