Using a NUR repo without adding it to the main NUR repo

I tried yesterday to use my own NUR repo in my configuration by just blindly copying the installation instructions from the main repo and replacing the URL to my own repository, but I couldn’t figure out how to access the packages in my own repository, doing pkgs.<name> didn’t work nor did nur.<name> work. I used the nur-expression-template to create my repository, and I’m guessing that the way they are structured they don’t work outside the main NUR repo?

1 Like

For your repository to show up in the nur.repos attribute you need to add yourself to the repos.json file. See the end of the How to add your own repository for instructions.

Meanwhile you can access your NUR directly through something like

nur-sondr3 = import (fetchTarball "https://github.com/sondr3/nix-expressions/archive/master.tar.gz") { inherit pkgs; }

and then do nur-sondr3.maple to reference the maple package, for example.

Thanks, I may or may not contribute it back; I haven’t decided yet, hence this post :slightly_smiling_face: I guess my question is rather, how would I make the packages in my NUR repository “globally” available in my configuration? I don’t want to have to add the let me = import (...) in { in each file I want to use a package from my repository.

Thanks for the reply though! I had forgotten about doing it that way and at least got my configuration to build again :smiley:

1 Like

I guess the simplest way would be to add something like

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

somewhere in your configuration and then use pkgs.nur-sondr3.<pkgname> to reference packages.

1 Like