Brain Structural Validation / Validate Markdown Structure & Links (push) Successful in 11s
Curate workstation subsystem guides covering Niri/Alacritty/Tmux navigation, Nix flake check linters, and the DMS operational reproducibility plan.
10 KiB
10 KiB
type, status, project, tags
| type | status | project | tags | ||||
|---|---|---|---|---|---|---|---|
| plan | completed | nixos |
|
Architecture Plan: DMS Runtime Ownership & Workstation Operations Manual
1. Executive Diagnostic: The DMS Ownership & Mutation Model
The initial inclination to solve the "absent Niri bindings" problem by symlinking dms/binds.kdl and settings.json into /nix/store via Home Manager would reproduce a critical architectural failure mode: fighting the application's runtime mutation model.
The Failure Mode of Store-Symlinking Mutable State
DMS is not a static window manager configuration; it is a live shell environment with a Quickshell UI and a CLI control daemon. It actively writes to $HOME/.config when:
- Connecting or rearranging monitors (
outputs.kdl). - Generating Material You themes from wallpapers (
colors.kdl). - Updating gaps, blur, corner radius, or widget layouts via GUI (
layout.kdl,alttab.kdl,settings.json). - Rebinding shortcuts in the DMS Settings UI (
binds.kdl).
If Home Manager symlinks these files to the read-only Nix store:
- User actions in the GUI (e.g., rearranging displays on an external monitor) fail with
EACCESor break symlinks. - Any subsequent
nixos-rebuild switchforcibly stomps runtime changes. - The system pretends to be declarative while undermining the user's interactive workflow.
graph TD
subgraph "Nix / Git Layer (What the Workstation IS)"
NIX_SYS["system/desktop.nix<br/>(Niri, DMS, Greetd daemons)"]
NIX_HM["home/desktop.nix<br/>(Compositor config & user binds)"]
NIX_HM --> NIRI_MAIN["~/.config/niri/config.kdl<br/><i>(Store Symlink)</i>"]
NIX_HM --> NIRI_CUST["~/.config/niri/custom.kdl<br/><i>(Store Symlink)</i>"]
end
subgraph "DMS Runtime Layer (How the Desktop is Configured)"
DMS_DAEMON["dms run (Daemon)"]
DMS_DAEMON -->|Dynamic Matugen| D_COL["~/.config/niri/dms/colors.kdl"]
DMS_DAEMON -->|Display hotplug| D_OUT["~/.config/niri/dms/outputs.kdl"]
DMS_DAEMON -->|UI Settings| D_SET["~/.config/DankMaterialShell/settings.json"]
DMS_DAEMON -->|GUI Rebinds| D_BINDS["~/.config/niri/dms/binds.kdl"]
end
subgraph "One-Time Initialization (Fresh Bootstrap)"
BOOTSTRAP["dms setup binds"] -.->|Seeds initial 0644 file| D_BINDS
end
NIRI_MAIN -->|include optional=true| D_BINDS
NIRI_MAIN -->|include| NIRI_CUST
2. State Ownership & Responsibility Matrix
| Scope / File | Authority | Managed in Git? | Mutability | Rationale |
|---|---|---|---|---|
system/desktop.nix |
NixOS Root | Yes | Immutable | Declares system daemons, PAM, Greetd, DMS package, fontconfig. |
home/config/niri/config.kdl |
Home Manager | Yes | Immutable | Compositor foundation: touchpad rules, gesture rules, includes. |
home/config/niri/custom.kdl |
Home Manager | Yes | Immutable | Workstation operator shortcuts (Mod+Return terminal, Mod+B browser, scripts). |
~/.config/niri/dms/binds.kdl |
DMS Runtime | No (Seeded) | Mutable (0644) |
DMS default keybindings. Initialized via dms setup binds; mutable by user/GUI. |
~/.config/DankMaterialShell/settings.json |
DMS Runtime | No | Mutable | Live panel layout, widget configuration, and theme preferences. |
~/.config/niri/dms/outputs.kdl |
DMS Runtime | No | Dynamic | Generated by DMS upon monitor connection/re-arrangement. |
~/.config/niri/dms/colors.kdl |
DMS Runtime | No | Dynamic | Generated by Matugen on wallpaper change. |
~/.config/niri/dms/layout.kdl |
DMS Runtime | No | Dynamic | Generated by DMS from corner radius and gap settings. |
3. The Workstation Operational Manual (docs/)
We will author an operational manual organized by the questions an operator asks when configuring, maintaining, or recovering the system:
docs/
├── getting-started.md # "How do I get this running?" (Bare-metal install to running desktop)
├── adding-software.md # "Where does a new application go?" (Decision tree, package vs module)
├── configuration.md # "How do I change something?" (Workflow: edit, test, switch, dotfiles)
├── system-lifecycle.md # "What happens when I rebuild?" (Eval, build, generations, rollbacks, GC)
├── desktop.md # "How does the Niri + DMS stack work?" (Ownership boundary, shortcuts, init)
├── secrets.md # "How are secrets handled?" (Operator CLI workstation vs Core consumer)
├── networking.md # "How does network access work?" (OpenSSH client profiles, WiFi, Tailscale)
└── reference/
├── shell.md # Bash, Starship, custom modular shell scripts
├── tmux.md # Tmux keybindings, layout, workflow
├── neovim.md # Neovim architecture, LSP, treesitter, plugins
└── antigravity.md # AI agent environment, guidelines, and tool integration
Detailed Document Specifications
1. docs/getting-started.md
- Bare-metal Recovery Protocol:
- Boot minimal NixOS ISO.
- Partitioning, filesystem formatting, and mounting.
- Generating
system/hardware-configuration.nix. - Cloning
Configto/home/kiskaadee/Config. - Dry build validation:
nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link. - System installation:
nixos-install --flake .#laptop. - Reboot and initial login via
dank-greeter.
- Desktop Initialization Phase:
- Run
dms setup bindsto seed the mutable DMS keybinding baseline. - Verification of spotlight, clipboard, and task manager overlays.
- Run
- Operator Secrets Bootstrap:
- Restoring
~/.config/sops/age/keys.txtto re-enable authoring access toCore.
- Restoring
2. docs/adding-software.md
- Package Placement Flowchart:
Is it a kernel module, hardware driver, or root systemd daemon? ├── YES ──> system/core.nix or system/hardware.nix └── NO │ Is it a GUI application or desktop utility? ├── YES ──> home/desktop.nix └── NO │ Is it a compiler, LSP, language runtime, or dev tool? ├── YES ──> home/dev.nix └── NO ──> home/shell.nix (CLI tools, shell integration) - Declaration Styles: When to use
home.packages = with pkgs; [...]vsprograms.<name>.enable = truevs NixOS service modules. - Handling Unfree Packages: Scoping unfree packages in
flake.nix.
3. docs/configuration.md
- Standard Modification Workflow:
Identify Domain -> Edit Module -> nix flake check -> nix build ... --no-link -> nixos-rebuild test -> switch -> git commit - Dotfile Management: Managing configuration via
home.filevsxdg.configFilevs runtime mutable directories. - The "Build, Never Switch" Boundary: Why agents build dryly and users trigger activation.
4. docs/system-lifecycle.md
- The Lifecycle Pipeline:
- Evaluation (
flake.nix) -> Derivation computation (/nix/store/*.drv) -> Build closure -> System profile link -> Activation scripts (PAM, users, systemd) -> Home Manager activation (dotfiles symlinks, user units).
- Evaluation (
- Command Matrix:
buildvstestvsswitchvsboot. - Generations & Rollback: Bootloader rollback,
nixos-rebuild --rollback, checking generations. - Maintenance: Safe garbage collection (
nix-collect-garbage -d), boot generation pruning, flake input locking (nix flake update).
5. docs/desktop.md
- The Compositor & Shell Architecture:
- Niri as the Wayland scrollable-tiling compositor.
- DankMaterialShell as the companion panel, app launcher, notification server, and quicksettings UI.
- Greetd and DankGreeter display manager configuration.
- The Ownership Boundary: Full documentation of declarative Git state vs DMS mutable runtime state.
- Master Shortcut Reference: Unified table combining Niri core shortcuts, custom user binds (
custom.kdl), and DMS IPC actions (binds.kdl).
6. docs/secrets.md
- Workstation vs Homelab Secrets Split:
- Laptop is the Authoring Cockpit: Owns
sops,age, andrbwCLI tools inhome/dev.nix; holds~/.config/sops/age/keys.txt. - Server is the Headless Consumer: Owns host SSH private key (
/etc/ssh/ssh_host_ed25519_key); decrypts secrets at boot viasops-nixinCore.
- Laptop is the Authoring Cockpit: Owns
- Step-by-step guide for rotating and authoring secrets for
Corefrom the laptop.
7. docs/networking.md
- NetworkManager configuration and CLI operations (
nmcli). - Workstation OpenSSH client profiles (
server-local,server-remote,gitea.roadtotech.me). - Local OpenSSH daemon for LAN remote access (and why it
\neqserver infrastructure).
8. docs/reference/
- Specialized manuals migrated and streamlined:
docs/reference/shell.md: Bash configuration, Starship prompt, modular scripts inhome/shell/.docs/reference/tmux.md: Streamlined tmux configuration and session commands.docs/reference/neovim.md: Neovim architecture, keybindings, LSP configs, and Treesitter.docs/reference/antigravity.md: Antigravity guidelines, rules, and workspace integration.
4. Execution Steps
- Retain Clean Repository Boundary:
- Do NOT symlink
settings.jsonorbinds.kdlto/nix/store. - Preserve
home/config/niri/config.kdlandhome/config/niri/custom.kdlas the declarative core.
- Do NOT symlink
- Author the Operational Manual:
- Create
docs/getting-started.md. - Create
docs/adding-software.md. - Create
docs/configuration.md. - Create
docs/system-lifecycle.md. - Create
docs/desktop.md. - Create
docs/secrets.md(renaming/refiningsecrets-management.md). - Create
docs/networking.md. - Create
docs/reference/directory and populateshell.md,tmux.md,neovim.md, andantigravity.md. - Clean up obsolete files (
package-and-secrets.md,development-environments.md,system-maintenance.md).
- Create
- Align Repository Index:
- Update
Config/README.mdto link directly into the new operational documentation structure.
- Update
- Validate:
- Run
nix flake checkand dry build (nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link). - Sync notes and guides into
~/Brain.
- Run