Skip to main content

Buildout recipe for creating Nix expressions from eggs list

Project description


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:

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


list of packages to generate expressions for


string to define the name used in the resulting derivation and in the generated filenames (defaults to part name)


string to set prefix (or path) for generated outputs (defaults to working directory)


list of existing buildout sections to install in mkDerivation based expression (defaults to all but the current section)


list of full generated expression filenames to filter outputs to be generated (defaults to nothing to generate all)


boolean (true) to allow generated expression to use package from buildout download cache (defaults to false)


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


list of package=other.package mappings to inject additional requirements for packages (usually to enable some additional features)


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)


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 = [
  shellHook = ''
    export SSL_CERT_FILE=~/.nix-profile/etc/ca-bundle.crt

And example ./buildout.cfg:

parts = 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):

extends =
parts = plone
versions = versions

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

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

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


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.

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-1.0.3.tar.gz (11.8 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