Very first steps with Nix on Debian

27 Jun 2021 One-minute read

Mixing Debian with Nix, my first steps.

Why Nix?

Because Debian is currently frozen. Or, because $some_package is not (yet) available in Debian.


To install, as root, do:

apt install nix nix-setup-systemd

then, as user:

nix-channel --add
nix-channel --update

followed by a package you wish to run from Nix. For example, Nyxt.

(19 May 2022: In an earlier version of this blog, I had written" nix-channel update", without the hyphens. Thanks, Greg)

nix-env --install nyxt

To find this Nyxt and other applications you install via Nix, you should add the path to your shell. For example:

export PATH=$PATH:$HOME/.nix-profile/bin

If this works for you, add it to your .bashrc.

Lastly, check if you're in the group nix-users. If not, as root

adduser $your_user_name_here nix-users


If you get

error: opening lock file ‘/nix/var/nix/profiles/per-user/root/profile.lock’: Permission denied

then rm ~/.nix-profile and try again. This is probably because you tried to use nix-env or nix-channel or something while root (source).


Three basic commands to keep your Nix packages up to date:

nix-channel --update nixpkgs
nix-env -u '*'
nix-collect-garbage -d