Skip to content

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-manager profile (on macOS, WSL, or a shared server) stays cleanly isolated from OS-level nixos sinks.

Yen solves all three with Cycle.js-style dataflow built into std.modules.all.

modules/fleet.nix
{
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:

  1. publish-host-info exposes host facts via osConfig so any child user or standalone home can read them.
  2. user-docker lives on yen.user.alice, yet enables virtualisation.docker upward on laptop and sets Alice’s d alias in Home Manager together.
  3. shell-env runs on both embedded user and standalone home (alice@laptop), reading osConfig.hostName downward in both places.
  4. standalone-profile tries to emit PermitRootLogin = "yes" onto nixos. Because std.modules.machines sets wall = true on home, Yen blocks that OS leak cleanly at the boundary.
modules/aspects.nix
{
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:

nix eval .#nixos + .#hm + .#home
{
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;
};
};
};
};
}

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.

ContributeCommunitySponsor