Hey, I’m using flake-parts
and trying to specify a type:
{
options.homeManagerModules = lib.mkOption {
# no such attribute `module`
type = lib.types.attrsOf lib.types.module;
};
config.homeManagerModules = {
foo = ./foo.nix;
bar = { programs.firefox.enable = true; };
# support a function module, as well
};
}
But I couldn’t find a type for this. Did I miss it or does it not exist? If it does not, would that be a good addition?
Does lib.types.deferredModule
work for you?
2 Likes
If your goal is to make the homeManagerModules
output composable in flake-parts, you could use code similar to this. The directory good-flake
contains the full example of this code being used and modules composition.
That code was based on the modules output of flake-parts prior to types.deferredModule
was set upstream, so you should use lib.types.deferredModule
instead of types.unspecified
as @rhendric suggested.
2 Likes
Yup, deferredModule
seems to be what I was needing. I actually read about it in the manual, but it sounded low level, so I thought it’s most likely not what I needed. And it seems like what I really want is to place my modules in flake.modules.<class>
, but merging seems to fail for some reason.
What exactly do you want to achieve?
I’m trying to define flake.modules.foo.bar
in one flake-part module and flake.modules.foo.baz
in another and that seems to fail… but it’s not like I have a minimal reproduction. I do have a reproduction though. In the discussion linked in my previous comment.
flake.modules is not a standard output, so it won’t compose without code similar to the one for flake.homeManagerModules from my first post in the thread
Oh, shoot! I just noticed that this feature is provided by an additional module that must be imported! Cancel cancel. Sorry and thank you.