Skip to content

add an onboarding script for new kernel-builder users#418

Merged
drbh merged 18 commits intomainfrom
onboard-script
Apr 1, 2026
Merged

add an onboarding script for new kernel-builder users#418
drbh merged 18 commits intomainfrom
onboard-script

Conversation

@sayakpaul
Copy link
Copy Markdown
Member

Fix #414

Screenshot 2026-03-31 at 1 29 22 PM

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

install.sh Outdated
Comment on lines +129 to +133
# Use 'trusted-substituters' and 'trusted-public-keys' — these are daemon-level
# settings (written to nix.conf as root) so they don't require the user to be
# in 'trusted-users'.
echo "extra-trusted-substituters = $HF_SUBSTITUTER" | sudo tee -a /etc/nix/nix.conf >/dev/null
echo "extra-trusted-public-keys = $HF_PUBLIC_KEY" | sudo tee -a /etc/nix/nix.conf >/dev/null
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe the keys should be trusted-substituters and trusted-public-keys (no extra)?

currently I get the following warning

warning: ignoring untrusted substituter 'https://huggingface.cachix.org', you are not a trusted user.
Run `man nix.conf` for more information on the `substituters` configuration option.
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user
warning: ignoring untrusted substituter 'https://huggingface.cachix.org', you are not a trusted user.
Run `man nix.conf` for more information on the `substituters` configuration option.
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am still getting

warning: ignoring untrusted substituter 'https://huggingface.cachix.org', you are not a trusted user.
Run `man nix.conf` for more information on the `substituters` configuration option.
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user

after trying out a bunch of options. I am afraid my knowledge about nix is too limited at this point to keep on digging. Any suggestions?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ooh I think we may need to add the user as a trusted-users = <username> otherwise the those values are ignored

Comment on lines +179 to +181
echo " Note: you may need to restart your shell or run:"
echo " . $NIX_PROFILE_SCRIPT"
echo ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this will likely be required since we cant update the users shell from within this bash script install (i think...)

when I tested locally I needed to run . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh since the cli was not found.

another possible idea is that we add a symlink to the profile path into a location that is likely loaded into the users env already. maybe something like

sudo ln -sf "$HOME/.nix-profile/bin/kernel-builder" /usr/local/bin/kernel-builder

although I'm not sure if this a bad practice when it comes to nix profiles. just a thought

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The script already sources the Nix profile via find_nix / . "$NIX_PROFILE_SCRIPT" within its own process, so kernel-builder --version works during the script.

I would prefer this to symlinking, though.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yea sorry I wasn't clear, I meant it is likely required for the user to run, if we don't have some other method to make it available automatically. might be worth exploring the symlink or some other approach.

However if this is too tedious, I also think its okay if we require the user to run . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh for now

extra-trusted-public-keys = $HF_PUBLIC_KEY
EOF
sudo systemctl restart nix-daemon 2>/dev/null || sudo pkill -HUP nix-daemon || true
sleep 3
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The issue is that systemctl restart might return before the Nix daemon is actually ready to serve requests with the new config — despite blocking on the unit state, the daemon's socket may not be ready yet.

This is needed in order to propagate the substitutes above to Nix config.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe there is a principled way of waiting until the socket is ready?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For an onboarding script, I think this is fine to relax a bit of complexity.

Copy link
Copy Markdown
Collaborator

@drbh drbh left a comment

Choose a reason for hiding this comment

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

lgtm, working as expected with

curl -Ls https://raw.githubusercontent.com/huggingface/kernels/6c4a107ba2c488ce50b9a19994e0a1e008fd2e08/install.sh | bash

@drbh drbh merged commit f8aab6d into main Apr 1, 2026
38 checks passed
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.

Create onboarding script with the new kernel-builder cli

4 participants