Skip to content

nix flake metadata drops the path attribute from the output #589

Description

@Adda0

Describe the bug

DetNix drops the path attribute on nix flake metadata, as opposed to Nix or Lix. Unless it is intentional, at which case the manual is wrong (still showing the path attribute), this seems like a bug.

Steps To Reproduce

$ nix run nixpkgs#nix -- --version
nix (Nix) 2.34.8
$ nix run nixpkgs#nix -- flake metadata github:NixOS/nixpkgs
Resolved URL:  github:NixOS/nixpkgs
Locked URL:    github:NixOS/nixpkgs/a1cc58a6e0d2b54da15eaeeca726e09ead1123a5?narHash=sha256-et1qSyVmYH1K3nGaYCHvcf6KPDe2YraKXXhAg/MwFwE%3D
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/44jrnl6bz2is6z4dqjssax13q0a4ri22-source
Revision:      a1cc58a6e0d2b54da15eaeeca726e09ead1123a5
Last modified: 2026-08-08 13:23:24
Fingerprint:   9d2bb51374f09939b9e03aface6a573df2f7b0f68d9c8edd15d90dc5ba191a7b

$ nix run nixpkgs#lix -- --version
nix (Lix, like Nix) 2.95.2
$ nix run nixpkgs#lix -- flake metadata github:NixOS/nixpkgs
Resolved URL:  github:NixOS/nixpkgs
Locked URL:    github:NixOS/nixpkgs/a1cc58a6e0d2b54da15eaeeca726e09ead1123a5
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/44jrnl6bz2is6z4dqjssax13q0a4ri22-source
Revision:      a1cc58a6e0d2b54da15eaeeca726e09ead1123a5
Last modified: 2026-08-08 13:23:24

$ nix run github:DeterminateSystems/nix-src -- --version
nix (Determinate Nix 3.22.0) 2.35.1
$ nix run github:DeterminateSystems/nix-src -- flake metadata github:NixOS/nixpkgs
Resolved URL:  github:NixOS/nixpkgs
Locked URL:    github:NixOS/nixpkgs/a1cc58a6e0d2b54da15eaeeca726e09ead1123a5
Description:   A collection of packages for the Nix package manager
Revision:      a1cc58a6e0d2b54da15eaeeca726e09ead1123a5
Last modified: 2026-08-08 13:23:24
Fingerprint:   bd7a263909bafeba70bf71194cb984d9c0f602c328b90769c883e97123b47139

Expected behavior

Per the manual, I expect all implementations to include the path attribute.

Metadata

Determinate Nixd daemon version: 3.21.9
Determinate Nixd client version: 3.21.9

You are running the latest version of Determinate Nix.

The following features are enabled:

 * lazy-trees
nix (Determinate Nix 3.21.9) 2.34.8

Additional context

Works the same with --json option.

I tried to see whether this is an intentional change, but could not find anything. If this is intentional, feel free to close the issue (after presumably modifying the manual).

I suppose it stems from the following hack in DetNix, maybe in combination with lazy trees?

// src/nix/flake.nix:200

        /* Hack to show the store path if available. */
        std::optional<StorePath> storePath;
        if (store->isInStore(flake.path.path.abs())) {
            auto path = store->toStorePath(flake.path.path.abs()).first;
            if (store->isValidPath(path))
                storePath = path;
        }

Nix does the following:

// src/nix/flake.nix:222

        /* Flakes do not get copied to the store, but are instead mounted at
           their expected store paths in storeFS. Querying metadata does not
           force copying to the store, as one would expect. */
        auto storePath = store->toStorePath(flake.path.path.abs()).first;

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions