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

Lluís Batlle i Rossell viriketo at gmail.com
Mon Nov 29 12:56:26 CET 2010


On Mon, Nov 29, 2010 at 12:38:04PM +0100, Cillian de Róiste wrote:
> Hi,
> 
> I'm having some trouble creating expressions for Python packages, I
> think I'm not setting the correct buildInputs or perhaps I need to use
> wrapProgram so set the PYTHONPATH correctly, although I may have
> simply misunderstood.
> 
> For example I've tried to add an expression for IPython to
> top-level/python-packages.nix which was something like:
> 
> ipython = buildPythonPackage {
>     name = "ipython-0.10.1";
>     src = fetchurl {
>       url = "http://ipython.scipy.org/dist/0.10.1/ipython-0.10.1.tar.gz";
>       sha256 = "18zwrg25zn72w4rmcwxzcw11ibgp001fawm2sz189zv86z70fxi2";
>     };
>   buildInputs = [ readline  ];
>     doCheck = false;
> }
> 
> This installs the package correcly with `nix-env -i python-ipython`
> although when I run `ipython` it complains that it cannot find
> readline.
> 
> I have configured my system python to have readline support:
> 
> nixpkgs.config.python = { readlineSupport = true; }
> 
> and confirmed it is correct:
> >>> readline
> <module 'readline' from
> '/nix/store/cr75hdfgmdb3m0lxdyakfva2bkv5hg6d-python-2.6.5/lib/python2.6/lib-dynload/readline.so'>
> 
> Looking at sys.path for ipython I see that the path to lib-dynload is different:
> /nix/store/nk3cihf5x24x3mxmwmg8dkv9g86klgkj-python-2.6.5/lib/python2.6/lib-dynload
> and this directory does not contain readline.so
> 
> I've tried many variations of buildInputs and attempted to use
> wrapProgram to add the path, but I can't figure it out.

Notice that buildPythonPage is going to use 'python = python26 = python26Base',
unless you overrided any of those.
Only python26Full uses the 'readlineSupport' config.

I'm not any python expert, but in similar situations I ended up doing tricks
like in 'keepnote' or 'offlineimap'.

Regards,
Lluís.



More information about the nix-dev mailing list