[Nix-dev] Presenting nix-index: a file-not-found utility

Benno Fünfstück benno.fuenfstueck at gmail.com
Fri Apr 21 12:36:35 CEST 2017


Hello nixers,

finding the package that provides a certain file in nixpkgs can be hard.
That is why I've written a tool to make the process easier, which I thought
would be helpful for other people as well:
https://github.com/bennofs/nix-index

To use it, you first have to generate an index:

$ nix-index # this will generate an index for `<nixpkgs>` in NIX_PATH

Note that it relies on the `ls{,.xz}` files from hydra, so for best results
you should use it with `<nixpkgs>` pointing at a channel to maximize the
chance of a path being available in the binary cache.

You also need to make sure that all packages in `<nixpkgs>` evaluate. This
is currently not the case for `nixos-unstable` or `nixos-17.03` (due to
some obsolete haskell overrides). So if you're not using `nixpkgs-unstable`
as your channel, you can instead run the following command to generate the
index using the `nixpkgs-unstable` channel: (the `-f` argument works like
the one from `nix-env`):

$  nix-index -f
https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre105825.67adf69a16/nixexprs.tar.xz

You can then search for files using `nix-locate`:

$ nix-locate 'extensions/secur.h'
xorg.xextproto.out                                2,141 r
/nix/store/riqpq4m0h0hqgif0kkwxkhzjpvz81x3g-xextproto-7.3.0/include/X11/extensions/secur.h
(wineUnstable.out)                                2,141 r
/nix/store/cl7b6kw7y8cqkpy4pnwwq4iqmaiw52d0-xextproto-7.3.0/include/X11/extensions/secur.h

The attribute path in parentheses indicates that the exact expression is
unknown, but the store path is in the closure of the printed attribute.

For more information, see the `--help` of the commands.


Regards,

Benno Fünfstück
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170421/26619436/attachment.html>


More information about the nix-dev mailing list