How can I install and use Nix packages like normal commands without root?
For example, I’d like to be able to run:
$ emacs
instead of:
$ ./nix run 'nixpkgs/release-23.11#emacs29-nox'
I have gotten as far as copying the nix command from ci build like:
$ curl -L https://hydra.nixos.org/job/nix/maintenance-2.16/buildStatic.x86_64-linux/latest/download-by-type/file/binary-dist > nix
And my ~/.config/nix/nix.conf
looks like:
experimental-features = nix-command flakes
ssl-cert-file = /etc/ssl/certs/ca-bundle.crt
store = $HOME/.local/share/nix/root
With this setup, I can run something like:
$ ./nix run 'nixpkgs/release-23.11#emacs29-nox'
which is ok, except it is cumbersome and it often seems to be re-downloading and can take a few minutes.
I thought there might be a way to install to a profile so I could run with a “normal” command and get it to just use the package in my local/non-root store without updating/downloading all the time.
Is this possible? How would I do it?
If I try to do this:
$ ./nix profile install 'nixpkgs/release-23.11#emacs29-nox'
I get:
error: opening directory '/nix/store/za63...-emacs-nox-29.2': No such file or directory
Here I was hoping ./nix profile
would do some of the same user namespace magic as what seems to be happening with ./nix run
.