Skip to content

lazy-trees: error when referencing parent flake from subflakeΒ #302

@GrahamDennis

Description

@GrahamDennis

Describe the bug

When trying to access the parent flake from a subflake (using builtins.getFlake), an error is printed claiming that a random nix store path does not exist (it does not exist on the filesystem). However this error only occurs when lazy-trees is enabled, when it is disabled this works fine.

This issue was reproduced using DetSys nix 3.14.0

Steps To Reproduce

  1. Clone this repository: https://github.com/GrahamDennis/nix-lazy-trees-error
  2. In the subflake directory, run nix eval --option lazy-trees true .#parentFlake.foo and an error is returned
error:
       … while calling the 'getFlake' builtin
         at /.../github.com/GrahamDennis/nix-lazy-trees-error/subflake/flake.nix:3:110:
            2|   outputs = { self, ... }: {
            3|     parentFlake = let attrs = { type = "path"; path = self.sourceInfo.outPath; narHash = self.narHash; }; in builtins.deepSeq attrs builtins.getFlake (builtins.flakeRefToString attrs);
             |                                                                                                              ^
            4|   };

       … while fetching the input 'path:/nix/store/kaf54rwjinjzi6w4fx4ap0nxy7b7zhjy-source?narHash=sha256-GHxO7WMR2ut8ZWLs7wWYExrKOxp4Aa58V%2Bq3krEA4l4%3D'

       error: path '//nix/store/kaf54rwjinjzi6w4fx4ap0nxy7b7zhjy-source' does not exist

(this is also described in the README for the repo)

Expected behavior

  1. Clone this repository: https://github.com/GrahamDennis/nix-lazy-trees-error
  2. In the subflake directory, run nix eval --option lazy-trees false .#parentFlake.foo and the result "bar" is printed.

Metadata

nix --version
nix (Determinate Nix 3.14.0) 2.32.4

Additional context

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