trofi / nix-guix-gentoo

Gentoo overlay for nix and guix functional package managers.
110 stars 9 forks source link

(new user) `nix-channel --update` fails #9

Closed eprst closed 3 years ago

eprst commented 3 years ago

Hi

I'm a new user, trying to set up nix. Added an overlay and tried to follow the instructions, however nix-channel --update fails:

konstantin@precision ~ $ echo $NIX_PATH
nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels:/home/konstantin/.nix-defexpr/channels
konstantin@precision ~ $ nix-channel --update
error: creating directory '/nix/store/.links': Permission denied

Am I missing anything? should I add myself to the nixbld group?

trofi commented 3 years ago

No, it should work as is.

I think /nix/store is supposed to be writable only by nix-daemon. Can you double-check it's running? At least in the past missing daemon was falling back to single-user setup and tried to manage files as a running user.

eprst commented 3 years ago

yeah, that was it. You probably want to add it to the guide printed by emerge:

 * Quick start user guide on Gentoo:
 * 
 * [as root] enable nix-daemon service:
 * [systemd] # systemctl enable nix-daemon
 * [openrc]  # rc-update add nix-daemon
(somewhere here: start the daemon)
 * [as a user] relogin to get environment and profile update

something still is not right though:

konstantin@precision ~ $ nix-channel --update
unpacking channels...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
konstantin@precision ~ $ 
konstantin@precision ~ $ nix-env -i mc
error: selector 'mc' matches no derivations
trofi commented 3 years ago

Yeah, updating the quickstart makes sense.

Let's see if you have any channels registered. Mine is:

$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable
trofi commented 3 years ago

Extended the quick-start with the command to add the channel: https://github.com/trofi/nix-guix-gentoo/commit/05e34af3a886ae1ce9c7d2e939eb1c64b80afc4b. Does it get things working for you?

eprst commented 3 years ago

Yes, this works, thanks. NixOS official doc says:

If you've just installed Nix on a non-NixOS distribution, you will be on the nixpkgs channel by default.

so probably makes sense to follow that?

trofi commented 3 years ago

Can you propose a possible change as a patch? I'm not sure I quite get how you see the end state of the printed howto.

eprst commented 3 years ago

no, printed howto is already good with https://github.com/trofi/nix-guix-gentoo/commit/05e34af3a886ae1ce9c7d2e939eb1c64b80afc4b. I was just saying that official doc suggests that nixpkgs channel should be enabled by default, so it might be a good idea to change the ebuild so that nix-channel --add https://nixos.org/channels/nixpkgs-unstable is done automatically during emerge.

Otherwise everything seems to be working for me, thanks.