Home Explore Blog CI



nix

8th chunk of `doc/manual/source/release-notes/rl-2.0.md`
0e331a2cfb3c9076dad19a0ed27cc89a07448c83b8f2e5b10000000100000a9c
    differs from the source path name (e.g. `builtins.path { path =
    ./foo; name = "bar";
                    }`) and also supports filtering out unwanted files.

  - `builtins.fetchurl` and `builtins.fetchTarball` now support `sha256`
    and `name` attributes.

  - `builtins.split` splits a string using a POSIX extended regular
    expression as the separator.

  - `builtins.partition` partitions the elements of a list into two
    lists, depending on a Boolean predicate.

  - `<nix/fetchurl.nix>` now uses the content-addressable tarball cache
    at <http://tarballs.nixos.org/>, just like `fetchurl` in Nixpkgs.
    (f2682e6e18a76ecbfb8a12c17e3a0ca15c084197)

  - In restricted and pure evaluation mode, builtin functions that
    download from the network (such as `fetchGit`) are permitted to
    fetch underneath a list of URI prefixes specified in the option
    `allowed-uris`.

The Nix build environment has the following changes:

  - Values such as Booleans, integers, (nested) lists and attribute sets
    can
    [now](https://github.com/NixOS/nix/commit/6de33a9c675b187437a2e1abbcb290981a89ecb1)
    be passed to builders in a non-lossy way. If the special attribute
    `__structuredAttrs` is set to `true`, the other derivation
    attributes are serialised in JSON format and made available to the
    builder via the file `.attrs.json` in the builder’s temporary
    directory. This obviates the need for `passAsFile` since JSON files
    have no size restrictions, unlike process environments.

    [As a convenience to Bash
    builders](https://github.com/NixOS/nix/commit/2d5b1b24bf70a498e4c0b378704cfdb6471cc699),
    Nix writes a script named `.attrs.sh` to the builder’s directory
    that initialises shell variables corresponding to all attributes
    that are representable in Bash. This includes non-nested
    (associative) arrays. For example, the attribute `hardening.format =
                    true` ends up as the Bash associative array element
    `${hardening[format]}`.

  - Builders can
    [now](https://github.com/NixOS/nix/commit/88e6bb76de5564b3217be9688677d1c89101b2a3)
    communicate what build phase they are in by writing messages to the
    file descriptor specified in `NIX_LOG_FD`. The current phase is
    shown by the `nix` progress indicator.

  - In Linux sandbox builds, we
    [now](https://github.com/NixOS/nix/commit/a2d92bb20e82a0957067ede60e91fab256948b41)
    provide a default `/bin/sh` (namely `ash` from BusyBox).

  - In structured attribute mode, `exportReferencesGraph`
    [exports](https://github.com/NixOS/nix/commit/c2b0d8749f7e77afc1c4b3e8dd36b7ee9720af4a)
    extended information about closures in JSON format. In particular,

Title: Nix Build Environment Enhancements: Structured Attributes, Build Phase Communication, Default Shell, and Closure Export
Summary
Nix build environment has been updated to pass Booleans, integers, (nested) lists and attribute sets to builders in a non-lossy way via JSON format in the `.attrs.json` file. A convenience script `.attrs.sh` is provided for Bash builders, initializing shell variables from attributes. Builders can communicate build phases by writing messages to the file descriptor specified in `NIX_LOG_FD`, improving the `nix` progress indicator. A default `/bin/sh` (ash from BusyBox) is now provided in Linux sandbox builds. In structured attribute mode, `exportReferencesGraph` exports extended closure information in JSON format.