When i search something with nix search nixpkgs
So in nix search nixpkgs it says its legacypackages. İ dont want to see it. İ just want to see that it only types assaultcube how to do it?
$ nix search nixpkgs assaultcube 2>/dev/null| sed -e 's|legacy.*linux\.||'
* assaultcube (1.3.0.2)
Fast and fun first-person-shooter based on the Cube fps
Or just live with it. Thats how we access things in a flake world anyway…
I have to ask. This is the first time I’ve seen ‘|’ in sed expressions instead of ‘/’. What is the difference and why prefer pipe?
It is just one of the possible delimiters, and I am used to them, as I often have slashes in my regexes and I want avoid escaping them.
The nix legacy world and nix flakes world are still somewhat distant from each other… Also, for a newcomer legacyPackages
sounds quite misleading.
There is another problem with the modern nix search
– it has lost the less
pager that was enabled by default and worked well. Moreover, there is no concise way of enabling it, because a naive nix search nixpkgs clang | less
prints a mixture:
evaluating 'legacyPackages.x86_64-linux.bear'* legacyPackages.x86_64-linux.bear (3.0.20)
evaluating 'legacyPackages.x86_64-linux.ccls' Tool that generates a compilation database for clang tooling
* legacyPackages.x86_64-linux.ccls (0.20210330)
evaluating 'legacyPackages.x86_64-linux.clang-analyzer' A c/c++ language server powered by clang
* legacyPackages.x86_64-linux.clang (11.1.0)
A C language family frontend for LLVM (wrapper script)
evaluating 'legacyPackages.x86_64-linux.clang-analyzer'* legacyPackages.x86_64-linux.clang-analyzer (13.0.1)
evaluating 'legacyPackages.x86_64-linux.clang-manpages' Clang Static Analyzer
* legacyPackages.x86_64-linux.clang-manpages (11.1.0)
man page for Clang 11.1.0
From an end user perspective the lack of easy to type and read nix search
is a big loss. Even for an experienced nix user like me (but who did not use flakes before).
legacyPackages
does not mean that any packages in it are legacy, it is about the mixed semantic of libraries, packages, builders, fetchers, etc.
Though I agree that paging is hardly possible as there is always the progress “streamed”.
I really wish that the experimental commands would be more sensible to a TTY being available.
I wanna +1 that and add that I find it quite a bad idea to restructure the way tools are used when users are already used to them.
‘nix search’ now has a slightly changed syntax in comparison to before which gave the feeling of falling back down on the ultra steep learning curve nixos would already provide.
It seems I’ve found the workaround for paging:
nix search nixpkgs | less -F
Somehow the -F
option prevents the progress text from being interleaved with the actual output.
Ah, it is not entirely true - there are still some progress messages.
Still the best option is to redirect stderr:
nix search nixpkgs 2>/dev/null | less
Sorry, I’m just starting with Nix this week (installed along a Ubuntu 24.04 box), and I was not understanding why my installation would return everything as legacyPackages.x86_64
when I do a nix search
.
From reading here, is it correct my understanding that it doesn’t mean anything, and it’s simply noise ?
It does mean something of course, but I dont think the differences should matter much to you. I answered your question more in depth on your stack overflow post
I would recommend a better (3rd-party) tool:
There’s also this:
GitHub - peterldowns/nix-search-cli: CLI for searching packages on search.nixos.org