Pass NixOS options to home-manager module

I’m trying to make a configurations system for my own use.

For that I just define a bunch of configuration options in a separate flake and then add it to my NixOS config flake. Then I can just do things like

{
plug.user.enableHomeManager = true;
plug.sway.enable = true;
}

to enable different parts of this configuration. In this example, I would like to somehow pass this plug.sway.enable option to home-manager module so it can enable sway-related options. But I’m struggling to find how to do it. config passed to home-manager is it’s own config and I didn’t find how to pass NixOS config to home-manager via something like extraSpecialArgs.

I would be glad if someone explained how it can be done.

Your looking for osConfig its mentioned here Home Manager Manual (your going to have to search for it in the page :p)

1 Like

Thanks! This is exactly what I wanted