Skip to content

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

Open

Description

@rrvsh

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:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions