Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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.

The minimal buildout part should include recipe and eggs:

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

The recipe generates three kind of expressions:

  • mkDerivation based [name].nix usable with nix-shell and nix-build
  • buildEnv based [name]-env.nix usable with nix-build
  • buildPythonPackage based [name]-[package].nix usable with nix-env -i -f

Fo large projects like Plone, it’s recommended to use a local mirrored package index / find-links to avoid connection issues when recipe is resolving each package fetchurl information. Possible remedies include setting allow-from-cache to true to allow recipe to use configured buildout download cache (and create file:// urls), or just running the buildout again with help of recipe created cumulative cache ([~/][.]collective.recipe.nix.cfg).

Known issue: If a requirement package has setup dependencies defined in setup_requires, those must be defined manually using propagated-build-inputs option for this recipe.

Recipe options

eggs
list of packages to generate expressions for
name
string to define the name used in the resulting derivation and in the generated filenames (defaults to part name)
prefix
string to set prefix (or path) for generated outputs (defaults to working directory)
parts
list of existing buildout sections to install in mkDerivation based expression (defaults to all but the current section)
outputs
list of full generated expression filenames to filter outputs to be generated (defaults to nothing to generate all)
allow-from-cache
boolean (true) to allow generated expression to use package from buildout download cache (defaults to false)
build-inputs
list of additional build-inputs from nixpkgs for generated expressions (to be available in nix-shell environment) or list of package=nixpkgsPackage mappings to inject build-inputs for each package’s buildPythonPackage-expression
propagated-build-inputs
list of package=other.package mappings to inject additional requirements for packages (usually to enable some additional features)
nixpkgs
list of package=pythonPackages.package mappings to use existing packages from nixpkgs instead of generating custom buildPythonPackage (useful with package like Pillow, which need additional care to get built properly)
urls
list of package=url#md5=hash mappings to explicitly define package download URL and MD5 checksum for cases where the recipe fails to resolve it automatically

See the project repository for configuration examples.

Example of generic use

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

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

And example ./buildout.cfg:

[buildout]
parts = releaser

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

Run the buildout:

$ nix-shell --run buildout-nix

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

$ nix-shell releaser.nix --run fullrelease

Or install zest.releaser into your current Nix profile with:

$ nix-env -i -f releaser-zest_releaser.nix

See the project repository for more configuration examples.

Example of building Plone

Together with nixpkgs optimized buildout version (available in nixpkgs), this recipe can be used to build a Nix derivation using buildout install as in Nix derivation builder (see the generated mkDerivation based expression for current example implementation):

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

[instance]
recipe = plone.recipe.zope2instance
eggs = Plone
user = admin:admin
environment-vars =
    PTS_LANGUAGES en
    zope_i18n_allowed_languages en
var = /tmp

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

[versions]
Pillow =
setuptools =
zc.buildout =
zc.recipe.egg =
$ nix-shell --run buildout-nix
$ nix-build plone.nix -o plone
$ plone/bin/instance fg

Changelog

1.0.3 (2015-08-30)

  • Updated pre-defined propagated build inputs with some known setup requires [datakurre]

1.0.2 (2015-07-28)

  • Fix issue where c.recipe.nix part was included in resulting nix expression [datakurre]

1.0.1 (2015-07-28)

  • Fix issue where buildout could not include ” characters [datakurre]
  • Fix to remove ~/.installed.cfg from built derivation

1.0.0 (2015-07-26)

  • First release.
Release History

Release History

This version
History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

0.18.3

History Node

0.18.2

History Node

0.18.1

History Node

0.18.0

History Node

0.17.1

History Node

0.17.0

History Node

0.16.0

History Node

0.15.1

History Node

0.15.0

History Node

0.14.1

History Node

0.14.0

History Node

0.13.2

History Node

0.13.1

History Node

0.13.0

History Node

0.12.1

History Node

0.12.0

History Node

0.11.0

History Node

0.10.1

History Node

0.10.0

History Node

0.9.3

History Node

0.9.2

History Node

0.9.1

History Node

0.9.0

History Node

0.8.0

History Node

0.7.0

History Node

0.6.0

History Node

0.5.0

History Node

0.4.0

History Node

0.3.0

History Node

0.2.0

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
collective.recipe.nix-1.0.3.tar.gz (11.8 kB) Copy SHA256 Checksum SHA256 Source Aug 30, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting