I’m trying to re-organize my config that uses both NixOS and Home-Manager configuration options by using NixOS modules. Ideally, I would only import each of the modules once. However, there are situations where I need to define both NixOS and Home-Manager options in one module (if I want to have only one module for each functionality).
An example for this would be a module for enabling zsh with my custom configuration options (which I set via Home-Manager):
I’ve dug around some more and this is my new understanding, plz correct me where wrong.
It seems the installation method matters, mine is flakes + nixosModule correct?
For the nixosModule and nixDarwin module there is osConfig which gives read access to a nixosConfiguration.
For the standalone installation method osConfig seems to be unavailable.
What I’m not sure I understand is, when using the nixosModule method, the evaluation of the user configuration happens within the evaluation of the nixosConfiguration, which is why osConfig is available - this is correct?
Shouldn’t it be possible in this specific combination (from the perspective of nix internals) to also allow setting nixosConfiguration options from within a home-manager module because everything is evaluated at once?
No, what happens when using the home-manager NixOS module (or nix-darwin module), is that all the home-manager options are nested inside a sub-heirarchy inside the NixOS module options under the home-manager attribute. So programs.zsh and home-manager.users.me.programs.zsh are not the same thing.