Skip to content

Can flakeModule live inside a flake-parts module? #2233

Description

@sshine

I am restructuring the terranix internal .nix file structure, and I've encountered a file, flake-module.nix, that is exported as flake.flakeModule. It lives in its own file because otherwise the https://flake.parts generator that makes the page https://flake.parts/options/terranix.html will not work correctly, according to some git messages from its former maintainers. This is a function that takes { terranix }: { ... } and returns a flakeModule, so it get concretized like:

flake.flakeModule = mkFlakeModule self;

If I move this function to a flake-parts module and embed it inside, e.g. like flake.lib.mkFlakeModule = ..., then I've heard the flake.parts website doc generator won't correctly render the terranix docs.

The reason I want to do this is to encapsulate every .nix file in a flake-parts module (dendritic pattern), but not at the cost of breaking external documentation.

Is what I'm saying correct? And would it be interesting to make the doc generator support that the flakeModule mustn't live as the top-level expression of a concrete file?

I apologize for not having done the research ahead of posting. I will investigate my options myself when I get to it.

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