Skip to content

Remove kriswill.* option gating; mount modules into hosts (nebula parity) - #21

Merged
kriswill merged 11 commits into
mainfrom
degating-host-mounts
Jul 3, 2026
Merged

Remove kriswill.* option gating; mount modules into hosts (nebula parity)#21
kriswill merged 11 commits into
mainfrom
degating-host-mounts

Conversation

@kriswill

@kriswill kriswill commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Removes the options.kriswill.<feature>.enable + lib.mkIf gating pattern and its core.nix mkDefault true fan-out. Feature selection is now expressed at the host, and the file arrangement deliberately mirrors the nebula-snowglobe NixOS branch so the two can merge cleanly later.

Three tiers (documented in knowledge/patterns/host-mounted-modules.md):

  • Universal (every darwin host): plain ungated deferred modules in flake.modules.darwin.<name>; hosts blanket-import the set. Override-prone scalars carry lib.mkDefault so a host can override with a plain assignment (lib.mkForce for the rest).
  • Host-selective: same location, gated behind an idiomatic enable — programs.<name>.* for user-facing programs (podman-desktop, claude-account-selector with its full option set), services.<name>.* for sub-flake re-exports (apple-container, codebase-memory-mcp) — flipped in the wanting host's default.nix.
  • Host-specific: files beside a host's default.nix (e.g. modules/hosts/SOC-Kris-Williams/alias-en0.nix).

Hosts are folders now: modules/hosts/<hostname>/default.nix (exact hostname; darwin today, nixos after the nebula merge).

Also in here

  • apple-container sub-flake options renamed kriswill.apple-container.*services.apple-container.*
  • modules/lib.nix (kriswill.lib) and mkProgramOption removed; the darwin realiser extends nixpkgs.lib inline (kanagawa kept)
  • ssh.nix/neovide.nix deleted — both were enable-toggle stubs with empty config bodies
  • nrs/nrt shell aliases became real executables (+ new nrb for root-less builds); the old nrt was silently broken — both nh darwin test and darwin-rebuild test no longer exist upstream, so nrt now runs darwin-rebuild check
  • okf scaffold understands the host-folder layout (host vs host-specific-file classification, attrset-form enable detection, basename-collision-safe doc names, re-export gating via comment hint)
  • AGENTS.md + knowledge bundle updated throughout: rewritten pattern doc, add-module playbook, decision record knowledge/decisions/remove-option-gating.md, log entries; okf validate 0/0
  • Seven findings from an xhigh multi-agent code review fixed in the final commit (including restoring the accidentally-dropped programs.direnv-nom.diff selector)

Verification

  • nix flake check green (builds all three host toplevels)
  • Closure parity: nix store diff-closures between pre-refactor baseline builds and the result is empty for all three hosts; the only eval-snapshot delta anywhere is the intentional services.apple-container string inside one error message
  • Live smoke test on host k: switched, activation links fresh (claude wrapper, tmux plugins.conf, direnv nom wrapper), container CLI + codebase-memory-mcp daemon verified
  • deadnix / statix / nixfmt clean; scaffold fixes exercised in a scratch repo copy including a synthetic basename collision

kriswill added 11 commits July 3, 2026 10:12
The sub-flake keeps its enable/package options (idiomatic API for a
module consumed by other repos), but moves out of the kriswill.*
namespace ahead of removing that namespace entirely. Lock refreshed
for the relative-path input's new narHash.
modules/lib.nix (options.kriswill.lib) is gone; modules/darwin.nix now
inlines the nixpkgs.lib.extend call for its specialArgs. lib/default.nix
shrinks to the kanagawa palette — mkProgramOption's only consumer was
nh.nix, which is now an ungated one-liner (programs.nh.enable toggle
removed from core.nix; the nrs/nrt aliases already used lib.getExe).
Drop options.kriswill.<feature>.enable + lib.mkIf from dnsmasq,
homebrew, ghostty, macos-defaults, fastfetch, git, kitty, neovim, oksh,
zk, diffnav, and dotfiles-stow — every gate evaluated to true on every
host (core.nix mkDefault fan-out / per-host dnsmasq), so a mounted
module is now simply active. Delete ssh.nix and neovide.nix outright:
both were enable-toggle stubs with empty config bodies (their real
config lives in the stow tree / host package lists). Matching fan-out
lines removed from core.nix, dnsmasq.enable removed from all hosts.
direnv, direnv-nom, tmux, zsh, yazi, htop, and qmd-sqlite lose their
mkIf gates; core.nix loses the kriswill.enable master option, the
mkDefault fan-out, and its config wrapper — it is now just the plain
always-on baseline. direnv-nom's cross-module gate on direnv collapses
(both universal) and its never-changed diff enum is hardcoded to nvd.
Hosts no longer set kriswill.enable.
flake.modules.darwin.* now holds only modules universal to all three
hosts; anything host-selective is a first-class dendritic file under
modules/hosts/ merging straight into configurations.darwin.<host>.module
(deferredModule definitions merge, same mechanism as nebula's
modules/hosts/nebula/*):

- claude-account-selector -> modules/hosts/k/ (k-only; its option set
  is hardcoded in the let block now that it has a single consumer)
- alias-en0 -> modules/hosts/SOC-Kris-Williams/
- podman-desktop, apple-container, codebase-memory-mcp -> single
  modules/hosts/*.nix files mounting a shared module into k + SOC

Host files shrink to the blanket import + host package list + platform
and overlays. The last kriswill.* option references are gone.
AGENTS.md teaches the new pattern (universal flake.modules.darwin.*
vs modules/hosts/ mounts, no enable options). knowledge/: the module
option pattern doc becomes patterns/host-mounted-modules.md, the
add-module playbook gains the where-does-it-mount decision, a decision
record (decisions/remove-option-gating.md) captures the rationale and
parity evidence, and okf scaffold now classifies modules/hosts/ files
as host definitions vs host-mounted feature mounts (stubbing the
latter into knowledge/modules/ with mount-site links). Catalog docs
refreshed; ssh/neovide/lib docs retired with their modules.
okf validate: 0 errors, 0 warnings.
Design revision: host-selective features return to modules/darwin/
behind idiomatic enable options instead of naked mount files under
modules/hosts/ —

- podman-desktop: programs.podman-desktop.enable
- claude-account-selector: full programs.claude-account-selector.*
  option set restored (defaultProfile/profiles/rules/desktopProfile);
  host k sets its values again
- apple-container + codebase-memory-mcp: back to plain re-exports of
  the sub-flake darwin modules; hosts opt in via services.<name>.enable

modules/hosts/ now holds only host folders named by exact hostname
(k/, mini/, SOC-Kris-Williams/ — each a default.nix, darwin or later
nixos), with truly host-specific files beside default.nix
(SOC-Kris-Williams/alias-en0.nix).
AGENTS.md and the knowledge bundle now describe the three tiers:
universal (ungated flake.modules.darwin.*), host-selective (behind
programs./services. enables flipped in modules/hosts/<hostname>/
default.nix), and host-specific files beside a host's default.nix.
okf scaffold classifies host folders (flat <host>.nix still recognized
for nebula compat), stubs host-specific sibling files as darwin-module
docs, and notes the enable option in gated modules' stubs. Decision
record and log updated; okf validate 0/0.
The nrs/nrt environment.shellAliases only existed in interactive zsh,
so non-interactive shells (agent harnesses, scripts) couldn't use them
— and nrt was silently broken anyway: both 'nh darwin test' and
'darwin-rebuild test' have been removed upstream. The nh module now
ships writeShellScriptBin helpers instead:

  nrs — nh darwin switch (sudo at activation)
  nrb — nh darwin build (no root; safe for agents)  [new]
  nrt — darwin-rebuild check (build + system.checks, no activation)

Extra args pass through (nrs -v, nrb --dry). Verified: helpers land in
sw/bin and nrb runs from a non-interactive shell; closure diff vs the
running system is just the three scripts (~2 KiB).
- direnv-nom: restore the accidentally-removed closure-diff selector as
  programs.direnv-nom.diff (nvd/native/none, default nvd) — a behavior
  setting on a universal module, not a gate; the optionalString guards
  are live again
- universal modules: re-add lib.mkDefault to override-prone scalars
  (dnsmasq enable/bind/addresses-as-a-whole (types.attrs — no per-key
  merging), homebrew enable/onActivation, macos-defaults, neovim env
  vars, oksh ENV, zsh history/highlighting). EDITOR uses mkOverride 900:
  nix-darwin's own 'EDITOR = mkDefault nano' would tie with a second
  mkDefault. mkForce escape hatch documented in the pattern doc and
  decision record
- nh: nrs/nrb share an mkNhHelper instead of copy-pasted script bodies
- okf scaffold: sub-flake re-exports are no longer stamped 'mounted
  ungated' (enable option detected from the backticked comment hint,
  generic gated fallback otherwise); attrset-form
  'programs.<x> = { enable = true; }' host enables are detected;
  same-basename host-specific files get host-qualified doc names
  instead of silently colliding; module descriptions prefer the leading
  comment over arbitrary option description strings

Verified: flake check green on all hosts; nix store diff-closures vs
the running system is empty (only darwin-version dirtyRev churn);
scaffold fixes exercised in a scratch repo copy incl. a synthetic
mini/alias-en0.nix collision; okf validate 0/0.
@kriswill
kriswill merged commit 3fbf52b into main Jul 3, 2026
@kriswill
kriswill deleted the degating-host-mounts branch July 3, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant