Install packages from NUR with flakes

I’ve noticed that NUR is listed in the flakes registry:

nix registry list | grep NUR
global flake:nur github:nix-community/NUR

Is it possible to install NUR packages in my profile? If yes, how can I do that?

Have you tried it as explained in their README?

https://github.com/nix-community/nur#flake-support

Disclaimer: I’m not using the NUR.

The example they give in the README seems to be relevant to NixOS only. I’m using Nix on macOS.

I’ve tried:

nix profile install nur#hello

but it does not work.

The NUR flake only provides an overlay as its sole output. I’m not sure if you can use it like that, without “instantiating” a nixpkgs first that uses that overlay.

https://github.com/NobbZ/tstool/blob/7d86c95b1d9acf51b0ae8bf5b028d92d22fbfbf4/flake.nix#L13-L19

Here you can see how I apply some local overlay to the nixpkgs import within a flake of a side project of mine (of which now have 3 days or so been to figure out how to combine the inputs properly :D)

So there is no equivalent to:

nix-env -f '<nixpkgs>' -iA nur.repos.mic92.hello-nur

with flakes then? @Mic92 can you confirm this?

Yeah, there is no equivalent of this, and as far as I understand this is by design.

Similarily, there is no (idiomatic) equivalent of NIXPKGS_ALLOW_UNFREE nix-shell -p steam --run steam.

I can do NIXPKGS_ALLOW_UNFREE nix run --impure nixpkgs#steam, though I have been told that this feature might actually get removed and I shouldn’t rely on the behaviour.

Right now you cannot use it with nix-env or its modern variant. You can use it with flakes in NixOS like this: https://github.com/Mic92/dotfiles/blob/8dda8feb6af6b28ff75b7411f0a4717da2e7f00b/nixos/configurations.nix#L29

2 Likes