Why do the package category directories exist?

Why are the package definitions in the nixpkgs github sorted into arbitrary categories instead of one giant flat directory containing a folder for each package name?
I.e.

nixpkgs/pkgs/tools/security
nixpkgs/pkgs/games
nixpkgs/pkgs/applications/graphics

and so on

It makes it quite annoying to search for a specific package when trying to update something and I cannot think of any obvious benefits of having that structure.

2 Likes

because if thousands of packages are in on directory github’s webui and the speed of tools that list directories fall apart. Same reason as why many CDNs use split hashes in URLs.

Are you searching by hand through the directories?
An efficient way is to use ripgrep, fd or nix edit.

Makes sense, however I find the proposal from the RFC to make more sense. Lot’s of good reasons there too.

I find using the terminal to be quite cumbersome in general. I find myself googling for command flags and options each time I use them because they are so inconsistent, which is why I usually use github search instead, which unfortunately is terrible.
I have a clone of nixpkgs on my system, but if I used that I’d also have to keep it up to date, which I often forget.

I would highly recommend you to get comfortable with the terminal. If you configured a few things to your likely, you can get really really productive with it and in counter part to UI programs, you can change and adapt things.

Are you using the command history Ctrl+R? fzf makes that amazingly easy to use.

Are you using the new search?

Not hard if you get used to doing it and have upstream and your fork as a remote.
git fetch --all --tags --prune && git rebase upstream/master

You can use https://search.nixos.org/ to find the package you want and then click on the source button which will link you to the code on github.

I do that regularly, it is really quite helpful. But sometimes it is not enough to find sources. Especially for builtins.

I have been trying that for ~8 years now. I am at a point where I am seriously considering developing an interpreted programming language with the intention of replacing bash.

Using nixos has solved most of my battles with the terminal, since I started using it, for the most part do not need to spend hours typing arcane insanity into bash for hours to get where I want to be.

I am, I also have zsh set up, which makes things more bearable, but it is still a long way from using an established programming language and an IDE that can recommend member functions and parse docstrings.

I have been using sourcegraph in the past, but I have not tried the new search yet.

Like zsh, fish, nu shell or Elvish?

shellscript is an established programming language but yeah, there are no docstrings like in python.

Nu Shell seems nice, I did not know about it.
I will give it a try over the coming weeks.
I tried the others in the past and did not really enjoy them all that much since they are still too close to bash.
I get that it needs to be possible to call legacy commands, but I believe that that costs these languages a lot of freedom.

I have also spent some time using ammonite since I do a lot of scala programming for work, which is enjoyable since the stdlib is really strong and auto-completion works nicely with it, but then there calling system commands is a hassle because the language was never designed to be a repl language.
Statically typed bash programming is also a weird thing since stdout basically becomes a kinda callback-y stream of chars, which can make pipeing annoying.

maybe I should give ba.bash.ka a try.

I phrased that poorly.