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?

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.

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

I’m not sure since when this started working, but I just did nix profile install nur#repos.shadowrz.klassy-qt6 and it worked perfectly.

I just realized this probably only worked because I have something in my nix config that adds all flake inputs to the flake registry. It’s from here: internal/modules/base/nix.nix · 7003fdba4cac27af986d474c1cfe76807a31daf3 · Garuda Linux 🦅 / Garuda Nix Subsystem · GitLab

Indeed, nix profile install nur#repos.mic92.hello-nur seems to work now. Thanks!