Skip to content
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

how to correctly install Nix on ArchLinux #879

Closed
k2s opened this issue Apr 13, 2016 · 19 comments
Closed

how to correctly install Nix on ArchLinux #879

k2s opened this issue Apr 13, 2016 · 19 comments
Assignees

Comments

@k2s
Copy link

k2s commented Apr 13, 2016

situation:

./configure --prefix=/usr \
              --libexecdir="/usr/lib/$pkgname" \
              --sysconfdir=/etc \
              --enable-gc
make
make install

expected:

  • out of box working Nix (nix-env, nix-channel, etc.) under root account
  • not usable Nix under user accounts

current result:

  • logging in as root first time will initialize Nix for root
  • but running nix-env will print error message:
warning: the group ‘nixbld’ specified in ‘build-users-group’ does not exist
building path(s) ‘/nix/store/n2i7g8pmylm2wbxz2hl1fvyfz3ay7vcp-user-environment’
error: the group ‘nixbld’ specified in ‘build-users-group’ does not exist
  • logging in as regular user will always print messages:
mkdir: cannot create directory ‘/nix/var/nix/profiles/per-user/k2s’: Permission denied
stat: cannot stat '/nix/var/nix/profiles/per-user/k2s': No such file or directory
Nix: WARNING: bad ownership on /nix/var/nix/profiles/per-user/k2s, should be 1000
mkdir: cannot create directory ‘/nix/var/nix/gcroots/per-user/k2s’: Permission denied
stat: cannot stat '/nix/var/nix/gcroots/per-user/k2s': No such file or directory
Nix: WARNING: bad ownership on /nix/var/nix/gcroots/per-user/k2s, should be 1000
/usr/lib/prezto/modules/fasd/init.zsh:32: permission denied: /usr/lib/prezto/modules/fasd/cache.zsh

I would like to fix Nix installation on ArchLinux, but need to understand:

  1. should latest version of Nix be installed always with multiuser in mind ?
  2. build-users-group=nixbld seams to be now default setting (had to be added manually before), should it be somehow cleared in /etc/nix/nix.conf or should it be always created in OS package ?
  3. Nix install will not chmod 1777 /nix/var/nix/{profiles,gcroots}/per-user. Should ArchLinux package always apply this or should nix-profile.sh.in be changed to handle such situation (handle non-multiuser setup) ?
@wmertens
Copy link
Contributor

Looks like nix is assuming things about nixbld when running as root?

Not sure how to fix atm…

@k2s
Copy link
Author

k2s commented Apr 14, 2016

  1. reading edolstra reaction tells me, that Nix installation should support booth, single and multi, user setup
  2. If Nix relays now on nixbld group, I will create it in ArchLinux package. But would like to get some "authoritative" answer from Nix development team
  3. same issue was discovered by test so I would propose that @wmertens script should test if /nix/var/nix/{profiles,gcroots}/per-user was made writable

@wmertens
Copy link
Contributor

I think it would be a good idea to provide the nixbld group. The script doesn't need to test if that dir is writeable, in normal operation you simply get an error message, nothing more.

@roper79
Copy link

roper79 commented Jun 15, 2016

Any progress here, please?

@domenkozar
Copy link
Member

cc @edolstra, this one is very unpleasant.

@chrissound
Copy link

Yeah not too sure if I'm encountering the same problem but:

 ✘ chris@archamd  ~  nix-env -q
error: creating directory ‘/nix’: Permission denied
 ✘ chris@archamd  ~  sudo nix-env -q
warning: the group ‘nixbld’ specified in ‘build-users-group’ does not exist
 chris@archamd  ~  group
 ✘ chris@archamd  ~  sudo nix-env -i                                                                                                                                                         
warning: the group ‘nixbld’ specified in ‘build-users-group’ does not exist
error: getting information about ‘/root/.nix-defexpr’: No such file or directory
 ✘ chris@archamd  ~  sudo nix-env -i vim
warning: the group ‘nixbld’ specified in ‘build-users-group’ does not exist
error: getting information about ‘/root/.nix-defexpr’: No such file or directory

@ghost
Copy link

ghost commented Oct 26, 2016

I'm also having the same issues as @chrissound, unable to use nix on Archlinux because of this.

@chrissound
Copy link

chrissound commented Jan 25, 2017

Just tried this again and I'm still having issues:

nix-env -q        
error: Nix database directory ‘/nix/var/nix/db’ is not writable: Permission denied
sudo nix-env -q
warning: the group ‘nixbld’ specified in ‘build-users-group’ does not exist

@joachifm
Copy link

joachifm commented Jan 25, 2017

I've been using nix on arch linux for a long time. I use sysusers.d and tmpfiles.d to intialize stuff + the bootstrap tarball, works really well here ...
EDIT: that is to say, I don't know that there's really an issue with arch linux per se

@chrissound
Copy link

@joachifm what are sysusers.d and tmpfiles.d? I don't see any mention of those on http://nixos.org/nix/manual/ could you point me to any resources?

@joachifm
Copy link

@chrissound sorry, I was referring to systemd-{sysusers,tmpfiles}, a convenient method of initializing the requisite users and directory structure for nix.

@Cutuchiqueno
Copy link

@joachifm can you elaborate on the exact steps you took to get nix working with using your approach?

@joachifm
Copy link

@Cutuchiqueno I think this is a pretty good writeup https://gist.github.com/expipiplus1/e571ce88c608a1e83547c918591b149f.

@chrissound
Copy link

Just to confirm I got it working with the link provided. Thank you @joachifm

The AUR package (https://aur.archlinux.org/packages/nix/) would need to be updated to include those instructions in the PKGBUILD file. I had to mkdir /nix chown chris:chris /nix.

@mrkgnao
Copy link

mrkgnao commented Jun 8, 2017

@expipiplus1's instructions work for me too.

@steve-chavez
Copy link
Member

Thanks to the pointer by kyrias, I managed to make nix work in ArchLinux with:

sudo pacman -S rsync
bash <(curl https://nixos.org/nix/install) --daemon
# After finishing the installer there's this message:
# Before Nix will work in your existing shells, you'll need to close
# them and open them again. Other than that, you should be ready to go.

# Try it! Open a new terminal, and type:

#  $ nix-shell -p nix-info --run "nix-info -m"

# But the nix commands were not added to my PATH, did a:
source /etc/profile.d/nix.sh
# and all working good now, added that to my .bashrc as well

@bew
Copy link
Contributor

bew commented Jan 25, 2019

Fresh new user here, I did the same as @steve-chavez (#879 (comment)), it worked well!

I guess this issue can be closed?

@peti peti closed this as completed Jan 26, 2019
@joshleeb
Copy link

joshleeb commented Apr 4, 2019

Want to second @bew and @steve-chavez - following the steps in #879r410904367 (on a fresh Arch install) worked perfectly!!

@masterdezign
Copy link

See also this article https://wiki.archlinux.org/index.php/Nix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests