DeterminateSystems / zero-to-nix

Zero to Nix is your guide to learning Nix and flakes. Created by Determinate Systems.

Home Page:https://zero-to-nix.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrading nix with zero-to-nix installation

iburzynski opened this issue · comments

I'm facing difficulty upgrading my version of Nix to a newer version after installing with z2n.
When running the nix upgrade-nix command, I receive the following error:

replacing old 'nix-2.18.1'
installing 'nix-2.18.1'
building '/nix/store/msixrjlzq6svfmqbgz422rkw4jw8gsvn-user-environment.drv'...
error: opening lock file '/nix/var/nix/profiles/default.lock': Permission denied
error: program '/nix/store/azvn85cras6xv4z5j85fiy406f24r1q0-nix-2.18.1/bin/nix-env' failed with exit code 1

The newer version of Nix is not being used and the update is terminated due to a permission error. I am familiar with how to update Nix using the older channel-based method, but my understanding is that z2n doesn't use channels, so I'm not sure what the alternative approach is to get a more recent version of Nix with this installation method.

@iburzynski This issue should go away if you run with sudo