[Nix-dev] pypi2nix: generate full PYTHONPATH from requirements?

Daniel Hlynskyi abcz2.uprola at gmail.com
Sat Nov 5 21:50:02 CET 2016


I'm trying to use pypi2nix-generated expression to create Kallithea
service.

     systemd.services.kalithea = {
      after = [ "network.target" ];
      wantedBy = [ "multi-user.target" ];
      script =
      let ppath =
        concatMapStringsSep ":" (x:
"${x}/${python.interpreter.python.sitePackages}") (let self =
python.packages; in [
          # package
          self."Kallithea"
          # deps
          self."Babel"
          self."Beaker"
          self."FormEncode"
          self."Mako"
          self."Markdown"
          self."Pygments"
          self."Pylons"
          self."Routes"
          self."SQLAlchemy"
          self."URLObject"
          self."WebHelpers"
          self."WebOb"
          self."WebTest"
          self."Whoosh"
          self."celery"
          self."docutils"
          self."dulwich"
          self."mercurial"
          self."mock"
          self."py-bcrypt"
          self."python-dateutil"
          self."waitress"
          # second level deps
          self."MarkupSafe"
          self."funcsigs"
          self."pbr"
          self."six"
          # TODO: add all the others
        ]);
      in ''
        export PYTHONPATH=${ppath}
        ${pythonPackages.pasteScript}/bin/paster serve
${kallithea1}/etc/development.ini;
      '';
    };

So I need to feed PYTHONPATH into service, but I don't know a nice way to
recursively aggregate all the propagatedBuildInputs from Kallithea into
full PYTHONPATH
(and service wants all of them, as far as I understand)

So, is there a way to do this? I'm pretty new to Python infrastructure and
perhaps miss some obvious thing.

PS. Pinging my previous ask about PERL5LIB, which is an example of exact
this problem, but with Perl.

https://www.mail-archive.com/nix-dev@lists.science.uu.nl/msg22577.html

The solution I found breaks on Travis (I guess, it is of kind "import from
derivation", so it won't work generally)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20161105/a8faa3d8/attachment-0001.html>


More information about the nix-dev mailing list