Home Explore Blog Models CI



nix

8th chunk of `doc/manual/source/release-notes/rl-2.0.md`
be63e95c7dcff73758c3ddc589e0f81ea1a034e1e724b63d0000000100000a9c
    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 Builtin Function Extensions and Build Environment Updates
Summary
Nix updates include: **Builtin Functions:** `builtins.path` for flexible path handling/filtering; `fetchurl`/`fetchTarball` now support `sha256`/`name`; new `split` (regex string splitting) and `partition` (list segregation). Network fetching builtins can use `allowed-uris` in restricted modes, and a content-addressable tarball cache is utilized. **Build Environment:** Structured attribute passing now serializes complex values (Booleans, integers, lists, sets) as JSON when `__structuredAttrs` is true, bypassing environment size limits. A `.attrs.sh` script assists Bash builders. Builders can communicate build phases via `NIX_LOG_FD`. Linux sandbox builds provide a default `/bin/sh` (BusyBox `ash`). `exportReferencesGraph` now exports extended JSON closure info with structured attributes.