[Nix-dev] how to find packages by file?

Linus Heckemann acc at sphalerite.org
Wed Mar 15 14:13:48 CET 2017


On 14/03/17 20:24, Roni Choudhury wrote:
> So my second question is, *how do I know whether a package
> has .lib or .dev attributes?*

I know of two options for this:

 1. Look at the expressions in a nixpkgs checkout; a good starting point
is usually all-packages.nix to find the actual expression and its
outputs attribute.

 2. Use nix-repl — `nix-repl '<nixpkgs>'` will give you a REPL for the
nix language with autocompletion for that sort of thing, which can be
very helpful.

> A followup question: *if I didn't have libpangocairo.* already in my
> store, how would I know which package delivers it?*

Hopefully by grepping a nixpkgs checkout. Sometimes the library names
don't exactly correspond to expression names, and sometimes they're not
in the expressions at all; I'm not really sure what can be done about
that, unless there's an index of the files each derivation contains
floating about somewhere — I know there's at least a subset of that, for
implementing the command-not-found functionality that tells you what to
install to make commands available. I tried this with your example of
pangocairo and found this line, from some Haskell bindings...

  "gi-pangocairo" = callPackage
    ({ mkDerivation, base, bytestring, Cabal, containers, gi-cairo
     , gi-glib, gi-gobject, gi-pango, gobjectIntrospection, haskell-gi
     , haskell-gi-base, pango, system-cairo, system-pango, text
     , transformers
     }:

so at that point I'd try looking in the pango and cairo-related
packages... Not really ideal, but I don't know if there is a better way.

Linus


More information about the nix-dev mailing list