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

2017-03-16 Thread Vladimír Čunát
On 03/14/2017 09:24 PM, Roni Choudhury wrote:
> *how do I know whether a package has .lib or .dev attributes?*

We have functions lib.getLib and lib.getDev that determine this
correctly in almost all cases and return the output.

> However, if I include "pango" in my buildInputs, I wind up with the
> package at path /nix/store/*-pango-1.40.3-bin, which
> does not contain the library files I need, nor even a lib directory.

Our buildInputs has special handling for outputs, and just by adding
`pango` you should get visible everything you need, i.e. headers,
libraries, binaries.

You can find multiple-output documentation in the manual
http://nixos.org/nixpkgs/manual/#chap-multiple-output

--Vladimir



smime.p7s
Description: S/MIME Cryptographic Signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Benno Fünfstück
I've been working on a similar tool that stores the paths in a
locatedb-like format and compresses the result with zstandard. Size is
about 13mb

Bjørn Forsman  schrieb am Mi., 15. März 2017,
17:05:

> On 15 March 2017 at 16:39, Domen Kožar  wrote:
> > It's a few GB per channel commit. At least stored in SQL as-is.
> >
> > With compression and denormalization that could be improved though :)
>
> Ah, I guess that's why you have to run "apt-file update" on Debian to
> get it. It's not there by default.
>
> I checked one of the files that it downloads (Contents-amd64.gz).
> That's a 32 MiB file that when extracted becomes a 480 MiB plain text
> file. So it's comparable to your figure -- apt-file downloads a few of
> these files (one per apt repository).
>
> However, apt-file never extracts the files, it simply runs zfgrep on
> the ~32 MiB sized .gz files. So it's not that bad.
>
> Best regards,
> Bjørn Forsman
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Bjørn Forsman
On 15 March 2017 at 16:39, Domen Kožar  wrote:
> It's a few GB per channel commit. At least stored in SQL as-is.
>
> With compression and denormalization that could be improved though :)

Ah, I guess that's why you have to run "apt-file update" on Debian to
get it. It's not there by default.

I checked one of the files that it downloads (Contents-amd64.gz).
That's a 32 MiB file that when extracted becomes a 480 MiB plain text
file. So it's comparable to your figure -- apt-file downloads a few of
these files (one per apt repository).

However, apt-file never extracts the files, it simply runs zfgrep on
the ~32 MiB sized .gz files. So it's not that bad.

Best regards,
Bjørn Forsman
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Bjørn Forsman
On 15 March 2017 at 16:00, Domen Kožar  wrote:
> https://github.com/Enlambda/nix-channelstatus has working RESTful API to
> search by files,
> I plan to publish that as a web service in upcoming weeks.

That's nice, but IMHO we need that info offline. I think it could be
made a part of a channel, like the command-not-found DB, but for all
files, not just binaries.

Debian has apt-file, we should have something similar.

Best regards,
Bjørn Forsman
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Domen Kožar
It's a few GB per channel commit. At least stored in SQL as-is.

With compression and denormalization that could be improved though :)

On Wed, Mar 15, 2017 at 4:37 PM, Bjørn Forsman 
wrote:

> On 15 March 2017 at 16:00, Domen Kožar  wrote:
> > https://github.com/Enlambda/nix-channelstatus has working RESTful API to
> > search by files,
> > I plan to publish that as a web service in upcoming weeks.
>
> That's nice, but IMHO we need that info offline. I think it could be
> made a part of a channel, like the command-not-found DB, but for all
> files, not just binaries.
>
> Debian has apt-file, we should have something similar.
>
> Best regards,
> Bjørn Forsman
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Domen Kožar
https://github.com/Enlambda/nix-channelstatus has working RESTful API to
search by files,
I plan to publish that as a web service in upcoming weeks.

On Wed, Mar 15, 2017 at 3:55 PM, Profpatsch  wrote:

> On 17-03-15 01:13pm, Linus Heckemann wrote:
> > On 14/03/17 20:24, Roni Choudhury wrote:
> >  2. Use nix-repl — `nix-repl ''` will give you a REPL for the
> > nix language with autocompletion for that sort of thing, which can be
> > very helpful.
>
> Can confirm. Normally I use
> find /nix/store -iname "*library.so"
> to find the package name,
> then I grep nixpkgs for that name
> then I look at the outputs (whether it’s in `lib` or `out`)
> then I grep nixpkgs for the filename to find the attribute name
>
> The naming schemes are pretty similar, it could probably
> be automated fairly well.
>
> --
> Proudly written in Mutt with Vim on NixOS.
> Q: Why is this email five sentences or less?
> A: http://five.sentenc.es
> May take up to five days to read your message. If it’s urgent, call me.
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Profpatsch
On 17-03-15 01:13pm, Linus Heckemann wrote:
> On 14/03/17 20:24, Roni Choudhury wrote:
>  2. Use nix-repl — `nix-repl ''` will give you a REPL for the
> nix language with autocompletion for that sort of thing, which can be
> very helpful.

Can confirm. Normally I use
find /nix/store -iname "*library.so"
to find the package name,
then I grep nixpkgs for that name
then I look at the outputs (whether it’s in `lib` or `out`)
then I grep nixpkgs for the filename to find the attribute name

The naming schemes are pretty similar, it could probably
be automated fairly well.

-- 
Proudly written in Mutt with Vim on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es
May take up to five days to read your message. If it’s urgent, call me.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Linus Heckemann
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 ''` 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
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Christian Kauhaus
On 14.03.2017 21:24, Roni Choudhury wrote:
> And perhaps a related final question: *how do I know where a given directory
> in /nix/store "came from" - that is, how can I link something in the store to
> something in nixpkgs?*

I have no immediate answer for the first two questions, but to the third one:
use nix-store --query --deriver /nix/store/path/to/file . This will print the
source derivation. The derivation file contains information where it was built
from, but in most cases it is sufficient to simply look at the file name.

HTH

Christian

-- 
Dipl-Inf. Christian Kauhaus <>< · k...@flyingcircus.io · +49 345 219401-0
Flying Circus Internet Operations GmbH · http://flyingcircus.io
Forsterstraße 29 · 06112 Halle (Saale) · Deutschland
HR Stendal 21169 · Geschäftsführer: Christian Theune, Christian Zagrodnick



signature.asc
Description: OpenPGP digital signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


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

2017-03-15 Thread Roni Choudhury
Hi all-

I have some newbie-type questions, I hope that's ok.

Right now I am trying to set up a shell.nix file for a project that is not
necessarily designed to work under Nix. I'm going about this mainly by
dropping into an "empyt" shell, ru nning the build process, observing what
fails, then adding a dependency to shell.nix file and trying again.

My main question is, *how do I know what package to include to make use of
a given file?* By way of example, I currently require the file
*libpangocairo-1.0.so.0*. I have this file in my nix store, at this path:
*/nix/store/zb524gnvar0ymb47m1jcy667f7cci6g1-pango-1.40.3/lib/libpangocairo-1.0.so.0*.
However, if I include "pango" in my buildInputs, I wind up with the package
at path */nix/store/d2xiaxchih5wz4h9kgndfz3qj8vn1znr-pango-1.40.3-bin*,
which does not contain the library files I need, nor even a lib directory.
With fontconfig, I am able to include fontconfig.lib in my buildInputs to
get the libraries for that package (and also fontconfig.dev to get header
files, etc.), but pango has no lib attribute. So my second question is, *how
do I know whether a package has .lib or .dev attributes?*

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

And perhaps a related final question: *how do I know where a given
directory in /nix/store "came from" - that is, how can I link something in
the store to something in nixpkgs?*

I realize these are probably basic questions, but I'm trying to bootstrap
myself into higher understanding. Thanks in advance!

roni
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev