For multi-user nix installations 1, the NIX_PATH variable is empty. Here I briefly go over two approaches to mitigate this, one with nix-channel and

Nix, Channels and the NUR

submited by
Style Pass
2021-07-21 03:00:06

For multi-user nix installations 1, the NIX_PATH variable is empty. Here I briefly go over two approaches to mitigate this, one with nix-channel and the other by manual pinning. Note that this post will eventually be superseded for most cases by a better flake workflow.

The idea behind using a channel is essentially that the tar at a particular commit / tag will be downloaded and stored, typically at $HOME/.nix-defexpr/channels. This is in-fact a symlink typically as seen below.

This is in keeping with the profile data, since by default in a multi-user setup we have the equivalent of running nix-env --switch-profile /nix/var/nix/profiles/per-user/rg/profile.

Now we can use these names ('<nur>' , '<unstable>' and '<nixpkgs>' ) to write a relatively straightforward config.nix as follows:

The above snippet can be modified to swap out unstable for nixpkgs as well. It is generally a good idea to define nixpkgs anyway to make sure we can do things like nix-env -iA cowsay -f '<nixpkgs>' . This allows us to now interact with nur packages without any trouble.

Leave a Comment