One Feature for NixOS, Embedded HM & Standalone HM
Desktop features almost always span the OS and the user session: GDM lives in NixOS, dconf lives in Home Manager, and your standalone home-manager switch profile still wants to know facts about the host it runs on (osConfig).
Because std.modules.all already defines host, user, osConfig, and walled home, you only write the feature itself:
{ yen, std, ...}:{ imports = [ std.modules.all ];
yen.user.alice.email = "alice@example.org";
yen.host.desk = { workstation = true; users = [ yen.user.alice ]; };
# Standalone walled Home Manager profile on `desk`. yen.home."alice@desk" = { user = yen.user.alice; on = yen.host.desk; };}{ yen, at, ...}:{ # Publish host metadata once for both embedded users and standalone homes. yen.aspects.host-facts = { at = yen.kinds.host; osConfig = { host, ... }: { hostName = host.name; inherit (host) workstation; }; on.home.osConfig = { host, ... }: { hostName = host.name; inherit (host) workstation; }; };
# One desktop feature configures GDM on NixOS and dconf in embedded Home Manager. yen.aspects.gnome = { at = yen.kinds.host.where { workstation = true; }; nixos.services.xserver.displayManager.gdm.enable = true; on.user.hm.dconf.enable = true; };
# Shared user feature runs in BOTH embedded HM and standalone `home-manager switch`. yen.aspects.editor = { at = at.anyOf [ yen.kinds.user yen.kinds.home ]; hm = { osConfig, ... }: { programs.neovim.enable = true; home.sessionVariables.EDITOR_HOST = osConfig.hostName; }; };}Inspect all three outputs — NixOS (desk), embedded Home Manager (desk.alice), and standalone Home Manager (alice@desk):
{ hm = { desk = { alice = { dconf = { enable = true; }; home = { sessionVariables = { EDITOR_HOST = "desk"; }; }; programs = { neovim = { enable = true; }; }; }; }; }; home = { "alice@desk" = { home = { sessionVariables = { EDITOR_HOST = "desk"; }; }; programs = { neovim = { enable = true; }; }; }; }; nixos = { desk = { services = { xserver = { displayManager = { gdm = { enable = true; }; }; }; }; }; };}With std.lib.nixos, std.lib.hmIntoHost, and std.lib.homeManager wired in flake.nix, deploy the host and standalone profile independently:
sudo nixos-rebuild switch --flake .#deskhome-manager switch --flake .#alice@deskNext, see how to run MicroVM guests inside hosts and build cross-host peer meshes without infinite recursion in MicroVMs, Containers & Peer Meshes.