[Nix-dev] Re: Multiple packages from one source package

Ludovic Courtès ludovic.courtes at laas.fr
Fri Nov 9 16:27:48 CET 2007


Hi Marc,

Thanks for your reply.

Marc Weber <marco-oweber at gmx.de> writes:

> In debian you have
> source  - > binary [1] (I'm thinking of a library here)
>         `-> binary-dev [2] ( thus includes / kernel header files .. )
>             ....
> right?

Right, but it can be more complex.  For example, the Debian `avahi'
source package yields around 20 packages:

  avahi-daemon
  avahi-dnsconfd
  avahi-autoipd
  avahi-utils
  libavahi-common3
  libavahi-common-data
  libavahi-common-dev
  libavahi-core5
  libavahi-core-dev
  libavahi-client3
  libavahi-client-dev
  ...
  libavahi-glib1
  libavahi-glib-dev
  libavahi-qt3
  ...
  libavahi-ui0
  ...
  python-avahi

These packages have very different set of dependencies: to
`libavahi-qt3' depends on Qt3, but none of the other packages does,
`python-avahi' depends on Python but none of the other does,
`libavahi-ui0' depends on GTK+ but none of the other does, etc.

Installing all of these packages is definitely going to consume a lot of
space, especially if you end up pulling dependencies that are not used
elsewhere on your system.  Conversely, this package separation makes it
easy for the end-user to pick and choose only those components that are
needed, regardless of how many source packages implement them.

> Of course we can start passing
>   buildIpnuts = [ jpeglib jpeg_includes ]
>   or define extra attributes
>   buildInputs = concat [ jpeglib_and_includes ]

Right, that would be the idea.

> Would be more effort but perhaps we can automate this somehow?

Debian's Debhelper helps automate the library case, i.e., it almost
automatically creates a `libfoo' and `libfoo-dev' package for you.  So
this particular can probably be (partly) automated.  Nevertheless, the
more general case (as in the example above) needs more care and can
hardly be automated.

Actually, before thinking about automation, my question was more about
how you'd do it (by hand, first) using Nix.  Surely, you wouldn't want
to compile Avahi 20 times, for instance, once for each of those
packages.  So you need to be able to craft Nix expressions that reuse
the build.

(This can probably be done but I'm not yet in a position where I can
think of a solution.)

Thanks,
Ludovic.




More information about the nix-dev mailing list