Host ↔ User Wiring & Walled Homes
Desktop configurations naturally flow in two directions:
- A user feature (like Docker or 1Password) can enable its matching daemon on the host (
nixos) while configuring shell aliases in Home Manager. - User features can read host facts downward (like hostname or Wayland flags).
- Meanwhile, a standalone
home-managerprofile (on macOS, WSL, or a shared server) stays cleanly isolated from OS-levelnixossinks.
Yen solves all three with Cycle.js-style dataflow built into std.modules.all.
{ yen, std, ...}:{ imports = [ std.modules.all ];
yen.user.alice.email = "alice@example.org";
yen.host.laptop = { addr = "198.51.100.30"; users = [ yen.user.alice ]; };
# Standalone Home Manager profile running on `laptop` (`home` has `wall = true`). yen.home."alice@laptop" = { user = yen.user.alice; on = yen.host.laptop; };}Look at the four aspects in aspects.nix:
publish-host-infoexposes host facts viaosConfigso any child user or standalone home can read them.user-dockerlives onyen.user.alice, yet enablesvirtualisation.dockerupward onlaptopand sets Alice’sdalias in Home Manager together.shell-envruns on both embeddeduserand standalonehome(alice@laptop), readingosConfig.hostNamedownward in both places.standalone-profiletries to emitPermitRootLogin = "yes"ontonixos. Becausestd.modules.machinessetswall = trueonhome, Yen blocks that OS leak cleanly at the boundary.
{ yen, at, ...}:{ # 1. Host publishes read-only `osConfig` facts downward to embedded users and standalone homes. yen.aspects.publish-host-info = { at = yen.kinds.host; osConfig = { host, ... }: { hostName = host.name; hasDocker = true; }; on.home.osConfig = { host, ... }: { hostName = host.name; hasDocker = true; }; };
# 2. Embedded user requests Docker upward on NixOS AND configures her zsh alias. yen.aspects.user-docker = { at = yen.user.alice; nixos.virtualisation.docker.enable = true; hm.programs.zsh.shellAliases.d = "docker"; };
# 3. Shared profile runs on BOTH embedded `user` and standalone `home`, reading `osConfig`. yen.aspects.shell-env = { at = at.anyOf [ yen.kinds.user yen.kinds.home ]; hm = { osConfig, ... }: { home.sessionVariables.HOST_NAME = osConfig.hostName; }; };
# 4. Standalone `home` is walled (`wall = true`): any `nixos` emission is dropped at the boundary. yen.aspects.standalone-profile = { at = yen.kinds.home; nixos.services.openssh.settings.PermitRootLogin = "yes"; hm.programs.git.enable = true; };}Inspect the evaluated NixOS, embedded Home Manager, and standalone Home Manager outputs:
{ hm = { laptop = { alice = { home = { sessionVariables = { HOST_NAME = "laptop"; }; }; programs = { zsh = { shellAliases = { d = "docker"; }; }; }; }; }; }; home = { "alice@laptop" = { home = { sessionVariables = { HOST_NAME = "laptop"; }; }; programs = { git = { enable = true; }; }; }; }; nixos = { laptop = { virtualisation = { docker = { enable = true; }; }; }; };}How walls work (wall = true + passUp)
Section titled “How walls work (wall = true + passUp)”When you define a custom kind that should never modify its parent host, set wall = true and list the only sinks allowed past the wall in passUp:
yen.kinds.home = { extends = yen.kinds.place; wall = true; passUp = [ yen.kinds.root.sinks.out ];};Next, see how shared sinks let you declare capabilities once and target multiple tools with zero coupling in Write Once, Target Multiple Tools.