6

I can query available packages w/ nix-env -qa [package] but how can I look for optional packages (e.g. libraries) that depend on a primary package and can be loaded or installed separately? Example: Coq (coq-8.6) has packages coqPackages_8_6.ssreflect and coqPackages_8_6.mathcomp that I can get no information about in Nix AFAIK

jaam
  • 900
  • 4
  • 23

2 Answers2

5

nix search can also be used to search for packages. Caching all available packages is slow, but searching the cache is quite fast! Check nix search --help!

Dominik Schrempf
  • 827
  • 8
  • 14
4

I personally never use nix-env -qa because it is very slow. Instead, when I'm looking for a top-level package (an application), I use http://nixos.org/nixos/packages.html. When (like in your question), I'm looking for a non-top-level package, I use the auto-completion of nix repl. Run it with

nix repl '<nixpkgs>'

Now type for instance coqPackages and use auto-complete to see all the available versions. Type coqPackages_8_6. and use auto-complete to see all the available packages in this set.

Zimm i48
  • 2,901
  • 17
  • 26
  • Cool... BTW, `nix-env -iA nix-repl` gave "error: attribute ‘nix-repl’ in selection path ‘nix-repl’ not found" (but `nix-env -i nix-repl` worked) – jaam Jun 14 '17 at 21:29
  • Sorry I fixed my answer. – Zimm i48 Jun 14 '17 at 21:30
  • 1
    https://github.com/edolstra/nix-repl says that `nix-repl` is obsolete and one should use `nix repl` command these days, as the package was merged into Nix starting with version 1.12. – Anton Trunov Sep 07 '18 at 10:07