Searching packages: Difference between revisions

From NixOS Wiki
imported>Fricklerhandwerk
formatting and wording
imported>Vater
there is also a search for everybody's (experimental) darling flakes nowadays
Line 6: Line 6:
* Nix packages at [https://search.nixos.org/packages search.nixos.org/packages]
* Nix packages at [https://search.nixos.org/packages search.nixos.org/packages]
* NixOS options at [https://search.nixos.org/options search.nixos.org/options]
* NixOS options at [https://search.nixos.org/options search.nixos.org/options]
* packages for [[flakes]] at [https://search.nixos.org/flakes?type=options search.nixos.org/flakes?type=options]
* options for [[flakes]] at [https://search.nixos.org/flakes?type=packages search.nixos.org/flakes?type=packages]


* pros:
* pros:

Revision as of 23:15, 28 December 2022

There are multiple ways to search for a package name in nixpkgs.

Using search.nixos.org

There is a web service to search for

  • pros:
    • easy to use
    • allows filters
  • cons:
    • requires Internet connection

Using 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

Interactive package browsing with nix repl

You can start nix repl to load the nixpkgs repository and then use auto completion to search for packages.

$ nix repl
Welcome to Nix 2.8.1. Type :? for help.

nix-repl> :load <nixpkgs>
Added 16519 variables.

nix-repl> firef[PRESS TAB]

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.