[Nix-dev] library with python bindings

Andreas Herrmann andreash87 at gmx.ch
Thu Oct 9 16:18:06 CEST 2014


On Wednesday 08 October 2014 18:37:00 Damien Cassou wrote:
> On Wed, Oct 8, 2014 at 5:04 PM, Andreas Herrmann <andreash87 at gmx.ch> wrote:
> > How do I tell Nix to fix `PYTHONPATH` accordingly when this package is loaded, and also to wrap python accordingly?
> 
> I think you have to use things like
> 
> wrapProgram "$out/bin/yourprogram" --prefix PYTHONPATH : ...
> 
> and
> 
> propagatedBuildInputs
> 
> 
> Look at the existing derivations.
That was what I needed. I had looked at wrapPythonProgram beforem, which didn't work, because these programs are actually bash scripts, that call the python interpreter.

Now, I added `makeWrapper` to `buildInputs`, and added

    postFixup = ''
      for i in "$out/bin/"*; do
        wrapProgram "$i" --prefix PYTHONPATH ":" "$PYTHONPATH"
      done
    '';

to my derivation and everything works.

Thanks a lot.


More information about the nix-dev mailing list