Problems setting up NUR

Hi everyone, I’m having a hard time enabling NUR both in home-manager and in nixos.
I followed what was described in the git repo and in my configuration.nix I have

  nixpkgs.config.packageOverrides = pkgs: {
    nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
      inherit pkgs;
    };
  };

But when i try to execute
nix-shell -p nur.repos.mic92.hello-nur
I get error: undefined variable 'nur' at (string):1:94 in response.

Similarly for home-manager I added

  home-manager.users.davide = {config, lib, pkgs, ...} :
    let
      nurNoPkgs = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {};
    in
      {

        imports = [
          nurNoPkgs.repos.rycee.firefox-addons.simple-tab-groups
          nurNoPkgs.repos.rycee.firefox-addons.https-everywhere
          nurNoPkgs.repos.rycee.firefox-addons.unpaywall
          nurNoPkgs.repos.rycee.firefox-addons.firefox-color
          nurNoPkgs.repos.rycee.firefox-addons.facebook-container
          nurNoPkgs.repos.rycee.firefox-addons.vimium
        ];

But when I try to rebuild I get error: NUR import call didn't receive a pkgs argument, but the evaluation of NUR's rycee repository requires it.

My google-fu failed me and I do not know what else to do, thank you very much in advance.

The nur.repos.rycee.firefox-addons.xyz attributes are packages, not modules, which means that they need the pkgs argument. Also, they go in the programs.firefox.extensions option, not imports. See HM documentation and my configuration, for example.

1 Like

Oh, and for nix-shell to work you need the ~/.config/nixpkgs/config.nix style of setup. Commands such as nix-shell and nix-env won’t see the configuration you made in your configuration.nix file. See https://github.com/nix-community/NUR/#installation.

1 Like

Thank you very much for the help, I clearly misread NUR’s documentation.
In the end I added nur to home manager nixpkgs the same way I did for nixos:

  home-manager.users.davide = { pkgs, config, lib, ...} :
    {

      nixpkgs.config.packageOverrides = pkgs: {
        nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
          inherit pkgs;
        };
      };

after reading here that HM uses a private nixpkgs istance and it worked.