Home Explore Blog CI



nix

3rd chunk of `doc/manual/source/release-notes/rl-2.0.md`
d885980b5823cbff14c6a9af52ef2301be0f2ba32ae7692b0000000100000fec
      - `nix repl` replaces the external program `nix-repl`. It provides
        an interactive environment for evaluating and building Nix
        expressions. Note that it uses `linenoise-ng` instead of GNU
        Readline.

      - `nix upgrade-nix` upgrades Nix to the latest stable version.
        This requires that Nix is installed in a profile. (Thus it won’t
        work on NixOS, or if it’s installed outside of the Nix store.)

      - `nix verify` checks whether store paths are unmodified and/or
        “trusted” (see below). It replaces `nix-store --verify` and
        `nix-store
                                                                        --verify-path`.

      - `nix log` shows the build log of a package or path. If the
        build log is not available locally, it will try to obtain it
        from the configured substituters (such as
        [cache.nixos.org](https://cache.nixos.org/), which now
        provides build logs).

      - `nix edit` opens the source code of a package in your editor.

      - `nix eval` replaces `nix-instantiate --eval`.

      - `nix
                                                                        why-depends` shows why one store path has another in its
        closure. This is primarily useful to finding the causes of
        closure bloat. For example,

            nix why-depends nixpkgs.vlc nixpkgs.libdrm.dev

        shows a chain of files and fragments of file contents that cause
        the VLC package to have the “dev” output of `libdrm` in its
        closure — an undesirable situation.

      - `nix path-info` shows information about store paths, replacing
        `nix-store -q`. A useful feature is the option `--closure-size`
        (`-S`). For example, the following command show the closure
        sizes of every path in the current NixOS system closure, sorted
        by size:

            nix path-info -rS /run/current-system | sort -nk2

      - `nix optimise-store` replaces `nix-store --optimise`. The main
        difference is that it has a progress indicator.

    A number of low-level (“plumbing”) commands are also available:

      - `nix ls-store` and `nix
                                                                        ls-nar` list the contents of a store path or NAR file. The
        former is primarily useful in conjunction with remote stores,
        e.g.

            nix ls-store --store https://cache.nixos.org/ -lR /nix/store/0i2jd68mp5g6h2sa5k9c85rb80sn8hi9-hello-2.10

        lists the contents of path in a binary cache.

      - `nix cat-store` and `nix
                                                                        cat-nar` allow extracting a file from a store path or NAR file.

      - `nix dump-path` writes the contents of a store path to stdout in
        NAR format. This replaces `nix-store --dump`.

      - `nix
                                                                        show-derivation` displays a store derivation in JSON format.
        This is an alternative to `pp-aterm`.

      - `nix
                                                                        add-to-store` replaces `nix-store
                                                                        --add`.

      - `nix sign-paths` signs store paths.

      - `nix copy-sigs` copies signatures from one store to another.

      - `nix show-config` shows all configuration options and their
        current values.

  - The store abstraction that Nix has had for a long time to support
    store access via the Nix daemon has been extended
    significantly. In particular, substituters (which used to be
    external programs such as `download-from-binary-cache`) are now
    subclasses of the abstract `Store` class. This allows many Nix
    commands to operate on such store types. For example, `nix
    path-info` shows information about paths in your local Nix store,
    while `nix path-info --store https://cache.nixos.org/` shows
    information about paths in the specified binary cache. Similarly,

Title: More Nix 2.0 Subcommands and Store Abstraction Improvements
Summary
This section details additional subcommands in Nix 2.0, including `nix eval`, `nix why-depends`, `nix path-info`, and `nix optimise-store`. It also describes low-level commands like `nix ls-store`, `nix ls-nar`, `nix cat-store`, `nix cat-nar`, `nix dump-path`, `nix show-derivation`, `nix add-to-store`, `nix sign-paths`, `nix copy-sigs`, and `nix show-config`. Furthermore, the store abstraction has been improved, allowing substituters to be subclasses of the `Store` class, enabling Nix commands to operate on different store types (e.g., binary caches).