holochain / holonix

Holochain app development environment based on Nix.
4 stars 1 forks source link

Advertise cache #42

Closed ThetaSinner closed 1 month ago

ThetaSinner commented 1 month ago

See https://nixos.wiki/wiki/flakes

nixConfig is an attribute set of values which reflect the values given to nix.conf. This can extend the normal behavior of a user's nix experience by adding flake-specific configuration, such as a binary cache.

When using this flake, you will now see something like:

do you want to allow configuration setting 'substituters' to be set to 'https://holochain-ci.cachix.org' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y
do you want to allow configuration setting 'trusted-public-keys' to be set to 'holochain-ci.cachix.org-1:5IUSkZc0aoRS53rfkvH9Kid40NpyjwCMCzwRTXy+QN8=' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y

I'm not sure yet whether this extends to flakes that consume this one, but it should mean we can do away with the custom install script at some point. Just let Nix do the environment setup and let people install Nix however they'd like. Maybe it should stay as a convenience thing but certainly won't be absolutely necessary :)

The only downside with this, and I personally don't think that it's major, is that you need to be a trusted user.

echo "trusted-users = root thetasinner" >> /etc/nix/nix.conf
systemctl restart nix-daemon

and you're good to go. Otherwise you get warnings about you not being a trusted user so the cache is being ignored.

The alternative was that we forced the settings into the root config globally. I'm not sure that was better really.

ThetaSinner commented 1 month ago

which seems like a nix overprotection

Yeah, it's set up for use on a multi-user machine and least privilege is great if you have a way to elevate on demand but Nix doesn't give you that I don't think.