Cannot install nix package manager without sudo privileges

suspectum@lemmy.ml to nixos@lemmy.ml – 5 points –

First of all, I'm completely new to Nix and I have no idea what I'm doing. I would like to use it initially as a more general purpose replacement of conda environments for my AI-development workflow. To begin with, I'd like to install nix package manager at my work server where I don't have root access. I tried

sh <(curl -L https://nixos.org/nix/install) --no-daemon

however it tries to create /nix which I cannot do without sudo. I searched everywhere, but I don't seem to find a way to circumvent this.

Thanks!

10

You may wanna have a look at nix-portable if you don't have root access.

Above command will perform a single-user installation of Nix, meaning that /nix is owned by the invoking user. You should run this under your usual user account, not as root. The script will invoke sudo to create /nix if it doesn’t already exist.

https://nixos.org/download.html#nix-install-linux

Thanks! I do run it indeed as a user. I don't have a sudo access on this server so I would like to do a completely portable installation. I downloaded a portable binary for nix https://releases.nixos.org/?prefix=nix/nix-2.16.1/ and unpacked it on a file system, however when running nix it thinks that nix store is at /nix/store:

$ /work/apps/nix/store/jdijjdjl6gjh07s4mwgb6bvm501hmjvh-nix-2.16.1/bin/nix
-bash: /work/apps/nix/store/jdijjdjl6gjh07s4mwgb6bvm501hmjvh-nix-2.16.1/bin/nix: /nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory

So far I wasn't able to configure a different location for nix store: I created ~/.config/nix/nix.conf and put this line inside nix.storeDir = /work/apps/nix/store but it couldn't pick up the custom store location.