NUR icon indicating copy to clipboard operation
NUR copied to clipboard

Move top-level packages to a `pkgs` attribute

Open fgaz opened this issue 5 years ago • 10 comments

Followup from https://github.com/nix-community/NUR/pull/27#issuecomment-406816320

I propose to move all the packages from the top-level to a pkgs attribute, so that default.nix only contains pkgs, lib, modules, and overlays.

Pros:

  • more extensible and maintainable
  • avoids workarounds like this or this

Cons:

  • slightly more complicated basic structure
  • five more characters for the user to type
    • can be avoided by making the packages available at the top-level but using this repo's code, not individually on each nur-packages

fgaz avatar Jul 22 '18 13:07 fgaz

can be avoided by making the packages available at the top-level but using this repo's code, not individually on each nur-packages

You mean like nur.{pkgs,modules,overlays,lib}.paul.foo instead of nur.repos.paul.{pkgs,modules,overlays,lib}.foo? That might be pretty neat.

infinisil avatar Jul 22 '18 13:07 infinisil

I meant nur.repos.paul.foo (but done at this repo's level) in addition to nur.repos.paul.{pkgs,modules,overlays,lib}.foo, but nur.{pkgs,modules,overlays,lib}.paul.foo sounds even better! It's even one character less than the original ;-)

fgaz avatar Jul 22 '18 13:07 fgaz

As compatibility layer we could check for the existence of pkgs in the repository and fallback to top-level otherwise.

Mic92 avatar Jul 23 '18 15:07 Mic92

I'm not convinced that compatibility layer would be worth the extra complexity (and documentation effort). Right now, it's cheap to break the interface, only a dozen repos would have to be updated (again).

tilpner avatar Jul 23 '18 16:07 tilpner

Normally I would expect to be able to nix-build the repo top-level. If additional arguments are introduced it's going to make harder to provide defaults for all of them.

zimbatm avatar Jul 24 '18 09:07 zimbatm

@zimbatm What argument are you talking about? Implementing this should not add any arguments, just alter the structure of the returned attrset.

tilpner avatar Jul 24 '18 10:07 tilpner

doh, nevermind. I was still thinking of { pkgs, lib, ...} as the recommended default.nix arguments.

zimbatm avatar Jul 24 '18 12:07 zimbatm

Bump

fgaz avatar Aug 11 '18 21:08 fgaz

How about we introduce multiple types of repositories? Instead of cramming everything into one.

  • singlePackage for a single package. For example https://github.com/direnv/direnv
  • packageSet for a package set like https://github.com/garbas/nixpkgs-python
  • distro for a combination of nixos modules and packages
  • overlay ?

The details can vary

zimbatm avatar Aug 12 '18 12:08 zimbatm

FWIW I'm not so very fond of the nur.{pkgs,modules,overlays,lib}.paul.foo naming scheme since it seems to limit me to one of a few approved "top-level" namespaces.

So if I wanted to add a set of Home Manager modules I wouldn't know what to choose. I guess nur.modules.rycee.home-manager.foo might work but then it all gets mixed up with NixOS modules (and I also happen to have a NixOS module named home-manager 🙂).

I do think it is a good idea to endorse a pkgs attribute under which all packages go, i.e., nur.repos.paul.pkgs.foo.

rycee avatar Sep 02 '19 19:09 rycee