[Nix-dev] Question about writing expressions for Python packages

Marc Weber marco-oweber at gmx.de
Tue Nov 30 12:56:54 CET 2010


My internet connection was broken for about 12h.

Excerpts from Cillian de Róiste's message of Mon Nov 29 18:20:31 +0100 2010:
> I have copied the trick from offlineimap and it works fine. I will
> attach a patch to a separate email for IPython and investigate further
> for other packages.

AFAIK Lluís Batlle is no longer using offlineimap. I personally don't
like the hack he introduced to work around the pythonFull not being
default issue. As Michael Raskin told that time it was the only way
without causing massive rebuilds.

The patch I pointed you does something similar as overriding python
in packageOverrides, but it does it in nixpkgs so that it works out of
the box. It also means that you may have two version of libraries:

pythonFull -> dependency X -> ipython
python  -> dependency X -> other package
(because depnedency X depends on different python version it'll be built
two times). Peters way overrides python for all packages you might want
to install. So other package also depends on pythonFull then.

Its usage would look like this:

  offlineimap =
    let p = deepOverride { python = pythonFull; };
    import ../tools/networking/offlineimap p;
          // p replaces pkgs. In contrast to pkgs it is overriding
          // python by pythonFull everywhere.
          // The only ugly thing about it is that you have two versions
          // of all python libraries. But its a lot cleaner than the
          // import setuptools again using passing a different python
  };

A real use case is webkit requiring a different libsoup version
in several packages it depends on:

  webkit =
  let p = deepOverride {libsoup = gnome28.libsoup_2_31;};
  in builderDefsPackage ../development/libraries/webkit {
    inherit (p.gnome28) gtkdoc libsoup;
    inherit (p.gtkLibs) gtk atk pango glib;
    inherit (p) freetype fontconfig gettext gperf curl
      libjpeg libtiff libpng libxml2 libxslt sqlite
      icu cairo perl intltool automake libtool
      pkgconfig autoconf bison libproxy enchant
      python ruby which;
    inherit (p.gst_all) gstreamer gstPluginsBase gstFfmpeg
      gstPluginsGood;
    flex = p.flex2535;
    inherit (p.xlibs) libXt renderproto libXrender;
  };

Eelco Dolstra: 
  The patch I posted here is still valid except that webkit depends on
  more xlib packages now:
  http://thread.gmane.org/gmane.linux.distributions.nixos.scm/382/focus=5041
  and waiting for a comment for month - because I listened to comment
  which was "no reply is no ok".

  Maybe you find some minutes to write a short comment or commit it.

Marc Weber



More information about the nix-dev mailing list