Home Explore Blog CI



nix

7th chunk of `doc/manual/source/release-notes/rl-2.0.md`
0c2ed5926792704c741a2882d39d1acf23eb78ddfe6da8910000000100000fb1
  - `nix-env`
    [now](https://github.com/NixOS/nix/commit/b0cb11722626e906a73f10dd9a0c9eea29faf43a)
    ignores packages with bad derivation names (in particular those
    starting with a digit or containing a dot).

  - Many configuration options have been renamed, either because they
    were unnecessarily verbose (e.g. `build-use-sandbox` is now just
    `sandbox`) or to reflect generalised behaviour (e.g. `binary-caches`
    is now `substituters` because it allows arbitrary store URIs). The
    old names are still supported for compatibility.

  - The `max-jobs` option can
    [now](https://github.com/NixOS/nix/commit/7251d048fa812d2551b7003bc9f13a8f5d4c95a5)
    be set to `auto` to use the number of CPUs in the system.

  - Hashes can
    [now](https://github.com/NixOS/nix/commit/c0015e87af70f539f24d2aa2bc224a9d8b84276b)
    be specified in base-64 format, in addition to base-16 and the
    non-standard base-32.

  - `nix-shell` now uses `bashInteractive` from Nixpkgs, rather than the
    `bash` command that happens to be in the caller’s `PATH`. This is
    especially important on macOS where the `bash` provided by the
    system is seriously outdated and cannot execute `stdenv`’s setup
    script.

  - Nix can now automatically trigger a garbage collection if free disk
    space drops below a certain level during a build. This is configured
    using the `min-free` and `max-free` options.

  - `nix-store -q --roots` and `nix-store --gc --print-roots` now show
    temporary and in-memory roots.

  - Nix can now be extended with plugins. See the documentation of the
    `plugin-files` option for more details.

The Nix language has the following new features:

  - It supports floating point numbers. They are based on the C++
    `float` type and are supported by the existing numerical operators.
    Export and import to and from JSON and XML works, too.

  - Derivation attributes can now reference the outputs of the
    derivation using the `placeholder` builtin function. For example,
    the attribute

        configureFlags = "--prefix=${placeholder "out"} --includedir=${placeholder "dev"}";

    will cause the `configureFlags` environment variable to contain the
    actual store paths corresponding to the `out` and `dev` outputs.

The following builtin functions are new or extended:

  - `builtins.fetchGit` allows Git repositories to be fetched at
    evaluation time. Thus it differs from the `fetchgit` function in
    Nixpkgs, which fetches at build time and cannot be used to fetch Nix
    expressions during evaluation. A typical use case is to import
    external NixOS modules from your configuration, e.g.

        imports = [ (builtins.fetchGit https://github.com/edolstra/dwarffs + "/module.nix") ];

  - Similarly, `builtins.fetchMercurial` allows you to fetch Mercurial
    repositories.

  - `builtins.path` generalises `builtins.filterSource` and path
    literals (e.g. `./foo`). It allows specifying a store path name that
    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

Title: Further Nix Improvements: Nix-env, Configuration Options, Hashes, Nix-Shell, Garbage Collection, Plugins, Language Features and Build Environment
Summary
Nix has been updated with various improvements. `nix-env` ignores packages with bad derivation names. Many configuration options have been renamed for clarity. The `max-jobs` option can be set to `auto`. Hashes can be specified in base-64 format. `nix-shell` now uses `bashInteractive` from Nixpkgs. Nix can automatically trigger garbage collection based on free disk space. Nix can be extended with plugins. Floating-point numbers are now supported in the Nix language. Derivation attributes can reference outputs using the `placeholder` function. `builtins.fetchGit` and `builtins.fetchMercurial` allow fetching repositories at evaluation time. `builtins.path` generalises path handling. `builtins.fetchurl` and `builtins.fetchTarball` support `sha256` and `name` attributes. In restricted evaluation mode, network downloads are permitted under specified URI prefixes. The Nix build environment now preserves values such as Booleans, integers, and lists.