Home Explore Blog CI



nix

2nd chunk of `doc/manual/source/release-notes/rl-1.7.md`
0f29cca7b29ef71cc2dd8e4a5571e63c374ff073c818b82c000000010000082e
        environment containing the specified packages from Nixpkgs. For
        example, the command
        
            $ nix-shell -p sqlite xorg.libX11 hello
        
        will start a shell in which the given packages are present.
    
      - It now uses `shell.nix` as the default expression, falling back
        to `default.nix` if the former doesn’t exist. This makes it
        convenient to have a `shell.nix` in your project to set up a
        nice development environment.
    
      - It evaluates the derivation attribute `shellHook`, if set. Since
        `stdenv` does not normally execute this hook, it allows you to
        do `nix-shell`-specific setup.
    
      - It preserves the user’s timezone setting.

  - In chroots, Nix now sets up a `/dev` containing only a minimal set
    of devices (such as `/dev/null`). Note that it only does this if you
    *don’t* have `/dev` listed in your `build-chroot-dirs` setting;
    otherwise, it will bind-mount the `/dev` from outside the chroot.
    
    Similarly, if you don’t have `/dev/pts` listed in
    `build-chroot-dirs`, Nix will mount a private `devpts` filesystem on
    the chroot’s `/dev/pts`.

  - New built-in function: `builtins.toJSON`, which returns a JSON
    representation of a value.

  - `nix-env -q` has a new flag `--json` to print a JSON representation
    of the installed or available packages.

  - `nix-env` now supports meta attributes with more complex values,
    such as attribute sets.

  - The `-A` flag now allows attribute names with dots in them, e.g.
    
        $ nix-instantiate --eval '<nixos>' -A 'config.systemd.units."nscd.service".text'

  - The `--max-freed` option to `nix-store --gc` now accepts a unit
    specifier. For example, `nix-store --gc --max-freed
                    1G` will free up to 1 gigabyte of disk space.

  - `nix-collect-garbage` has a new flag `--delete-older-than` *N*`d`,
    which deletes all user environment generations older than *N* days.
    Likewise, `nix-env
                    --delete-generations` accepts a *N*`d` age limit.

Title: Nix Enhancements: nix-shell, Chroot Environments, JSON Support, and More
Summary
This section details several enhancements to Nix, including improvements to `nix-shell` such as the `--packages` flag, default expression selection with `shell.nix`, evaluation of the `shellHook` attribute, and timezone preservation. It also covers the setup of minimal `/dev` and private `devpts` filesystems in chroot environments. Furthermore, it introduces the `builtins.toJSON` function, a `--json` flag for `nix-env -q`, support for complex meta attributes in `nix-env`, attribute names with dots in the `-A` flag, unit specifiers for `--max-freed` in `nix-store --gc`, and a `--delete-older-than` flag for `nix-collect-garbage` and `nix-env --delete-generations`.