import-tree icon indicating copy to clipboard operation
import-tree copied to clipboard

Document how to extend the direct flake-parts form after the module result change

Open rrvsh opened this issue 2 months ago • 0 comments

Hi, thanks for import-tree.

The documentation shows this direct flake-parts form:

flake-parts.lib.mkFlake { inherit inputs; }
  (import-tree ./modules)

This still works. However, I encountered a compatibility change when extending that module with other definitions.

At 4ebb10ae17d5f1ad366e7aef5b92cb8eecf24f69, this worked because import-tree returned an attribute-set module:

flake-parts.lib.mkFlake { inherit inputs; } (
  (import-tree ./nix)
  // {
    flake.paths.root = ./.;
  }
)

Since e9177dd and #40, import-tree returns a module function. The same expression now fails with:

expected a set but found a function

I understand that this change was intentional to support direct use with lib.types.submodule.

The working migration is to introduce an outer module:

flake-parts.lib.mkFlake { inherit inputs; } {
  imports = [ (import-tree ./nix) ];
  flake.paths.root = ./.;
}

Could the flake-parts documentation include this composition form? A short migration note would also help users who extended the previous attribute-set result.

Relevant links:

rrvsh avatar Sep 18 '26 03:09 rrvsh