Difference between revisions of "Searching packages"
(Add Searchix) |
(Add `nps` as an option for searching packages) |
||
| Line 31: | Line 31: | ||
; cons: | ; cons: | ||
* it's very slow and requires a lot of memory | * it's very slow and requires a lot of memory | ||
| + | |||
| + | == Using the <code>nps</code> command == | ||
| + | |||
| + | <code>nps</code> caches entire <code>nix search nixpkgs ^</code> and <code>nix-env -qaP --description</code> results locally and queries the cache. | ||
| + | |||
| + | <syntaxhighlight lang="bash">nps firefox</syntaxhighlight> | ||
| + | |||
| + | ; pros: | ||
| + | * works offline | ||
| + | * very fast | ||
| + | * easy syntax | ||
| + | * output sorted by relevance | ||
| + | |||
| + | ; cons: | ||
| + | * [https://github.com/OleMussmann/nps/blob/main/README.md third party program] | ||
| + | * [https://github.com/OleMussmann/nps/blob/main/README.md#automatic-cache-refresh-optional-recommended- cache needs regular refreshing (automatable)] | ||
== Using the <code>nix repl</code> environment == | == Using the <code>nix repl</code> environment == | ||
Latest revision as of 16:27, 7 December 2025
There are multiple ways to search for a package name in nixpkgs.
Using search.nixos.org website
There is a web service to search for
- with channels
- Nix packages at search.nixos.org/packages
- NixOS options at search.nixos.org/options
- with flakes
- packages at search.nixos.org/flakes?type=packages
- options at search.nixos.org/flakes?type=options
- pros
- easy to use
- allows filters
- cons
- requires Internet connection
Using the nix search command
While this command is still experimental, you can use it to search for a package. It may be slow the first time, but further runs will use cached results.
nix --extra-experimental-features "nix-command flakes" search nixpkgs firefox
Using the nix-env command
It's possible to search for a package using nix-env -qaP
- pros
- works offline
- cons
- it's very slow and requires a lot of memory
Using the nps command
nps caches entire nix search nixpkgs ^ and nix-env -qaP --description results locally and queries the cache.
nps firefox
- pros
- works offline
- very fast
- easy syntax
- output sorted by relevance
- cons
Using the nix repl environment
With the read–eval–print loop (REPL) of nix you can browse packages interactively.
Starting the nix repl
nix repl
Welcome to Nix 2.8.1. Type :? for help.
nix-repl>
Loading the repository for nixpkgs
nix-repl>
:load <nixpkgs>
Added 16519 variables.
Type the first letters of a package
nix-repl>
firef
Press Tab ↹ key for auto completion
Reverse search: searching which package provides a file
There is a third party program nix-index to find which package provides a given file. This is particularly useful when you are looking for a very specific file but you don't know which package installs it.
Searchix
A combined search of NixOS modules, nix-darwin modules, home-manager modules, and nixpkgs