docs: simplify code comments, keep the detail in the README
CI / flake (pull_request) Successful in 3m27s

The registry / multi-user / portable-home rationale lives in the README
(Users, Hosts, Portable home); the corresponding code comments are reduced
to one-liners that point there. No functional change (host derivations are
unchanged).
This commit is contained in:
Emma Thorpe
2026-06-29 12:41:16 +01:00
parent ea3e75e0af
commit f7ae46f462
6 changed files with 27 additions and 80 deletions
+11 -38
View File
@@ -97,10 +97,7 @@
"lens-desktop"
];
# Identity registry: who each user is (name, email, keys, groups), keyed
# by username. Threaded into the system layer as the `userRegistry`
# specialArg and into each user's home config as the `identity` module
# arg. See users/registry.nix, modules/users.nix, home/git.nix.
# Per-user identity, keyed by username. See README "Users".
userRegistry = import ./users/registry.nix;
# nixpkgs + nix-daemon settings shared by NixOS and Darwin hosts.
@@ -132,14 +129,8 @@
}
];
# mkHost :: { system, modules, users, portable } -> nixosSystem
# Builds one machine by appending its host-specific modules to the shared
# baseModules. `users` is an attrset keyed by username; each value carries
# that user's home-module list and optional per-host-user system bits
# (e.g. linger). Per-user identity is injected into each home config via
# the `identity` module arg (extraSpecialArgs is per-host, so it cannot
# carry per-user data); the system layer reads the global `userRegistry`
# restricted to this host's `hostUsers` set.
# Build one NixOS host. `users` is an attrset keyed by username (home
# modules + optional per-user system bits). See README "Users".
mkHost =
{
system,
@@ -190,11 +181,8 @@
}
];
# mkDarwinHost :: { system, username, modules, homeModules } -> darwinSystem
# Darwin counterpart of mkHost. macOS already owns the login user, so we
# only attach the platform and home-manager; no NixOS user module here.
# Stays single-user (macOS owns the account); identity is still sourced
# from the registry so the shared home modules behave as on NixOS.
# Darwin counterpart of mkHost: single-user (macOS owns the account),
# identity still from the registry. See README "Users".
mkDarwinHost =
{
system,
@@ -223,12 +211,8 @@
];
};
# Host table — declarative registry of every machine. To add a host:
# give it a name, its `system`, its `users` set (each user's home-module
# list, plus optional per-host-user bits like linger), and the system
# `modules`. mapAttrs below turns each entry into a nixosConfiguration of
# the same name. Per-user home configs compose ./home (the shared bundle)
# with any per-user modules (e.g. ./users/emmathorpe/work.nix).
# Host table — one entry per machine, realised into a nixosConfiguration
# of the same name below. See README "Hosts" / "Users".
hosts = {
lyrathorpe-mbp = {
system = "aarch64-linux";
@@ -418,14 +402,8 @@
flake.nixosConfigurations = lib.mapAttrs (_name: mkHost) hosts;
flake.darwinConfigurations = lib.mapAttrs (_name: mkDarwinHost) darwinHosts;
# Reusable home modules, exported so this config can be consumed off these
# hosts -- by a standalone home-manager on a non-NixOS machine, or as an
# input to someone else's flake. `default` is the portable bundle
# (shell + git + editor + claude). Consumers must supply the module args
# these expect: `inputs` always; `identity` (see users/registry.nix) for
# git/desktop; `portable` for sway. `desktop`/`sway` additionally require
# a NixOS host that provides the Sway/Firefox binary -- they are not
# standalone-portable.
# Reusable home modules, exported for use off these hosts. See README
# "Portable home" for the consumer module-arg expectations.
flake.homeModules = {
default = ./home;
shell = ./home/shell.nix;
@@ -436,13 +414,8 @@
sway = ./home/sway.nix;
};
# Standalone home-manager configurations: the portable bundle built for a
# machine NOT managed by this flake (`home-manager switch --flake
# .#"<user>@<system>"`). Only the portable subset is exposed; the desktop
# suite stays NixOS-only. homeConfigurations are not per-system, so the
# system is encoded in the attribute name, and home.username/homeDirectory
# are set explicitly (the NixOS module sets them automatically; standalone
# does not).
# Standalone home-manager configs (portable bundle) for machines not
# managed by this flake. See README "Portable home".
flake.homeConfigurations =
let
mkHome =