-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
What is the best practice to expose a flakeModule that depends on other flake modules?
I have something like this:
flake.nix:
...
outputs = inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
imports = [./modules.nix];
};
...modules.nix:
{inputs, ...}:
{
imports = [inputs.flake-parts.flakeModules.flakeModules];
flake.flakeModules.default = import ./my-module.nix;
}my-module.nix:
{inputs, ...}: {
imports = [input.flake-dep1.flakeModule input.flake-dep2.flakeModule];
}I currently have 4 solutions, none of them feel optimal.
- Define the module in the same file, so I can access the outer scope.
- Pass a top-level argument to the module (then the module can't be imported directly via
imports, but one needs to do(import ./modules.nix { inherit inputs; })for example) - Have a wrapper for the module file inside the
modules.nix,{ imports = [...inputs, ./my-module.nix]; } - Split out the module as a module within the current flake that then defines the module.
I guess there are no _module.args.inputs or something that could be utilized?
What is the best practices for this kind of thing?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested