Most packages can be found in the nixpkgs repository. Some people maintain additional repositories such as haskell-nix-overlay. But they are less stable and probably depend on nixpkgs in some way.

Now how to find a package?

  • use grep (slow)
  • get gnu idutils. See HOWTO
  • use the nix-env command:
  nix-env -qa \* [-P] [--out-path] [ -f $NIXPKGS_ALL ]

to list all packages you can install. The first column is the attr path. However Nix has to evaluate all names so this is slow but bearable.

Eg put this into your ~/.bashrc

query(){ nix-env -qa \* -P -f $NIXPKGS_ALL | grep -i "$1"; }

You've found a package and it doesn't show up? If a package is defined as sub attribute set it is only shown if the function

recurseIntoAttrs

has been used. I think it was introduced for performance reasons (?). You can either add this function if its missing or you can install by path using nix-env -iA attr.subattr.subattr.package or such. The attr.subattr is the attr path shown by the query above. In this example it would match something like:

{
  attr = { subattr = { subattr = { package = mkDerivation ... } } }
  # of course you would use this notation instead:
  attr.subattr.subattr.package = mkDerivation ...;
}

You can also use ctags to find attr names fast. Install ctagsWrapped which tells ctags about the nix filetype by passing:

--langdef=NIX
--langmap=NIX:.nix
--regex-NIX=/([^ \t*]*)[ \t]*=/\1/f/