Skip to main content

Buildout recipe for creating Nix expressions from eggs list

Project description

collective.recipe.nix

This is an experimental buildout recipe for creating nix expression from a buildout eggs list. This is work in progress. Please, contribute.

Currently the recipe generates three kind of expressions:

  • default [name].nix usable with nix-shell

  • buildEnv based [name]-env.nix usable with nix-build

  • buildPythonPackage based [name]-package.nix usable with nix-env -i -f

Example of usage

At first, define ./default.nix with buildout:

with import <nixpkgs> {}; {
  myEnv = stdenv.mkDerivation {
    name = "myEnv";
    buildInputs = [
      pythonPackages.buildout
    ];
    shellHook = ''
      export SSL_CERT_FILE=~/.nix-profile/etc/ca-bundle.crt
    '';
  };
}

And example ./buildout.cfg:

[buildout]
extends = https://dist.plone.org/release/4-latest/versions.cfg
parts =
    plone
    releaser
versions = versions

[instance]
recipe = plone.recipe.zope2instance
eggs = Plone
user = admin:admin

[plone]
recipe = collective.recipe.nix
eggs =
    ${instance:eggs}
    plone.recipe.zope2instance

[releaser]
recipe = collective.recipe.nix
eggs = zest.releaser[recommended]

[versions]
zc.buildout =
setuptools =

Run the buildout:

$ nix-shell --run buildout

Now you should be able to run zest.releaser with recommended plugins with:

$ nix-shell zest.releaser.nix --run fullrelease

And launching python with all Plone dependencies (after removing buildout created site.py to remove references from buildout installed eggs) with:

$ rm -f parts/instance/site.py parts/instance/site.pyc
$ nix-shell plone.nix --run python

Plone could be started by entering the following lines into the interpreter:

import plone.recipe.zope2instance.ctl
plone.recipe.zope2instance.ctl.main(['-C', 'parts/instance/etc/zope.conf', 'fg'])

Advanced configuration

Adding additional nixpkgs buildInputs:

[plone]
...
build-inputs =
    redis

Mapping nixpkgs buildInputs for generated Python expressions:

[plone]
...
build-inputs =
   dataflake.fakeldap=pythonPackages."setuptools-git"

Mapping Python packages as propagatedBuildInputs for generated Python expressions:

[robot]
...
propagated-build-inputs =
   robotframework=robotframework-selenium2library

Replacing otherwise generated Python expressions with existing nixpkgs expressions:

[plone]
...
nixpkgs =
    python-ldap=pythonPackages.ldap

Adding URLs for packages not available at PyPI:

[plone]
...
urls =
    Plone=https://example.com/Plone-4.3.6.zip#md5=c370c0c8eace1081ec5b057b2c4149b7

or:

[plone]
...
urls = urls

[urls]
Plone = https://example.com/Plone-4.3.6.zip#md5=c370c0c8eace1081ec5b057b2c4149b7

Changelog

0.9.2 (2015-07-12)

  • Fix a few issues where package was not found at PyPI [datakurre]

0.9.1 (2015-07-11)

  • Fix issue where package requirement in wrong case caused error

  • Fix issue where buildout propagated-build-inputs did not support cyclic requirements (required for injecting ‘add-on’ packages) [datakurre]

0.9.0 (2015-07-10)

  • Refactor to handle properly setuptools requires extras [datakurre]

0.8.0 (2015-07-10)

  • Add support for comma separated list for inline build-inputs, propagated-build-inputs and nixpkgs [datakurre]

0.7.0 (2015-07-10)

  • Add option to inject propagatedBuildInputs to enable extra package-dependent additional features [datakurre]

0.6.0 (2015-07-10)

  • Add to create installable python package expression for each listed egg [datakurre]

0.5.0 (2015-07-09)

  • Fix to resolve cyclic dependencies by letting the first seen dependency win and persist into resulting expression [datakurre]

0.4.0 (2015-07-09)

  • Change to produce {name}-env.nix instead of {name}.env.nix as buildable derivations [datakurre]

0.3.0 (2015-07-08)

  • Change resulting derivation to be buildEnv with python.buildEnv to make it also nix-buildable [datakurre]

0.2.0 (2015-07-08)

  • Add buildout-based configuration [datakurre]

  • Back to development: 0.1.2 [datakurre]

0.1.1 (2015-07-08)

  • Add support for plone.app.ldap [datakurre]

0.1.0 (2015-07-08)

  • Proof of concept release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.recipe.nix-0.9.2.tar.gz (8.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page