Skip to content

flattenTree returns {} for a simple nested attrset (perhaps user error?) #121

@gautammohan

Description

@gautammohan

Describe the bug

I am trying to use flattenTree to collapse a nested attrset for my flake checks, and it returns an empty set instead of concatenating the keys.

To Reproduce

Steps to reproduce the behavior:
A minimal case in nix repl:

nix-repl> :lf github:numtide/flake-utils/v1.0.0
nix-repl> nixpkgs = import <nixpkgs> {}
nix-repl> pkgs = nixpkgs.pkgs
nix-repl> lib.flattenTree {zip = nixpkgs.pkgs.runCommand "foo" {} "bar";}     
{
  zip = «derivation /nix/store/j43kxmmazclshcr9xzdhic5r3s090ind-foo.drv»;
}

nix-repl> lib.flattenTree {zip.zap = nixpkgs.pkgs.runCommand "foo" {} "bar";}
{ }

Expected behavior

I expect the second command to output an attrset with {zip/zap: <...foo.drv>}, instead of an empty set.

System information

I am using the determinate nix installer (version 0.32.2) with a pinned nixpkgs of 24.05 for my flake. I am unsure about the version of <nixpkgs> in the repl, but this behavior is the same if I run my flake checks directly.

Additional context

I apologize in advance if this is a simple error or misuse of the function; I am still quite new to nix. However, perhaps this is still a useful issue since it feels like "unexpected" behavior, unless I am completely misinterpreting the purpose of flattenTree.

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