No description
Find a file
Eelco Dolstra 6de33a9c67
Add support for passing structured data to builders
Previously, all derivation attributes had to be coerced into strings
so that they could be passed via the environment. This is lossy
(e.g. lists get flattened, necessitating configureFlags
vs. configureFlagsArray, of which the latter cannot be specified as an
attribute), doesn't support attribute sets at all, and has size
limitations (necessitating hacks like passAsFile).

This patch adds a new mode for passing attributes to builders, namely
encoded as a JSON file ".attrs.json" in the current directory of the
builder. This mode is activated via the special attribute

  __structuredAttrs = true;

(The idea is that one day we can set this in stdenv.mkDerivation.)

For example,

  stdenv.mkDerivation {
    __structuredAttrs = true;
    name = "foo";
    buildInputs = [ pkgs.hello pkgs.cowsay ];
    doCheck = true;
    hardening.format = false;
  }

results in a ".attrs.json" file containing (sans the indentation):

  {
    "buildInputs": [],
    "builder": "/nix/store/ygl61ycpr2vjqrx775l1r2mw1g2rb754-bash-4.3-p48/bin/bash",
    "configureFlags": [
      "--with-foo",
      "--with-bar=1 2"
    ],
    "doCheck": true,
    "hardening": {
      "format": false
    },
    "name": "foo",
    "nativeBuildInputs": [
      "/nix/store/10h6li26i7g6z3mdpvra09yyf10mmzdr-hello-2.10",
      "/nix/store/4jnvjin0r6wp6cv1hdm5jbkx3vinlcvk-cowsay-3.03"
    ],
    "propagatedBuildInputs": [],
    "propagatedNativeBuildInputs": [],
    "stdenv": "/nix/store/f3hw3p8armnzy6xhd4h8s7anfjrs15n2-stdenv",
    "system": "x86_64-linux"
  }

"passAsFile" is ignored in this mode because it's not needed - large
strings are included directly in the JSON representation.

It is up to the builder to do something with the JSON
representation. For example, in bash-based builders, lists/attrsets of
string values could be mapped to bash (associative) arrays.
2017-01-26 20:40:33 +01:00
config Add config.guess, config.sub and install-sh 2013-11-25 11:26:02 +00:00
corepkgs Revert "Get rid of unicode quotes (#1140)" 2016-11-26 00:38:01 +01:00
doc/manual Drop a few more references to all-packages.nix 2017-01-03 16:42:24 +01:00
maintainers Update upload-release script 2017-01-03 11:42:56 +01:00
misc SSL_CERT_FILE -> NIX_SSL_CERT_FILE 2016-10-13 17:09:10 +02:00
mk Revert "Get rid of unicode quotes (#1140)" 2016-11-26 00:38:01 +01:00
perl Revert "Get rid of unicode quotes (#1140)" 2016-11-26 00:38:01 +01:00
scripts bail out if macOS 10.9 or lower is used during installer 2017-01-25 07:28:49 +01:00
src Add support for passing structured data to builders 2017-01-26 20:40:33 +01:00
tests Merge pull request #981 from shlevy/build-remote-c++ 2017-01-19 18:21:55 +01:00
.dir-locals.el Add .dir-locals.el for Emacs 2016-01-28 11:12:04 +01:00
.gitignore build-remote: Implement in C++ 2016-11-10 11:09:15 -05:00
bootstrap.sh bootstrap: Simplify & make more robust. 2011-09-06 12:11:05 +00:00
configure.ac Revert "Merge branch 'seccomp' of https://github.com/aszlig/nix" 2016-12-19 11:52:57 +01:00
COPYING * Change this to LGPL to keep the government happy. 2006-04-25 16:41:06 +00:00
local.mk Don't depend on git when generating source tarball 2015-10-15 11:53:45 -07:00
Makefile Merge pull request #981 from shlevy/build-remote-c++ 2017-01-19 18:21:55 +01:00
Makefile.config.in Makefile.config.in: drop unused bsddiff_compat_include 2017-01-24 22:50:28 +00:00
nix.spec.in Drop unused WWW::Curl dependency 2016-12-06 17:17:29 +01:00
README.md Readme semantics. 2017-01-01 05:20:47 +05:30
release.nix Revert "Merge branch 'seccomp' of https://github.com/aszlig/nix" 2016-12-19 11:52:57 +01:00
shell.nix shell.nix: Add a flag for using clang 2017-01-24 10:53:18 +01:00
version Bump 2016-01-20 16:34:37 +01:00

Nix, the purely functional package manager

Nix is a new take on package management that is fairly unique. Because of it's purity aspects, a lot of issues found in traditional package managers don't appear with Nix.

To find out more about the tool, usage and installation instructions, please read the manual, which is available on the Nix website at http://nixos.org/nix/manual.

Contributing

Take a look at the Hacking Section of the manual. It helps you to get started with building Nix from source.

License

Nix is released under the LGPL v2.1

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit.