How rgbcube/ncc works
Purpose and Entry Points
This is a Nix flake-based personal infrastructure/configuration repository (“ncc”), defining reproducible host systems, user environments, services, and a small set of custom packages. The flake entry point and pinned dependency graph are flake.nix and flake.lock. Host-specific compositions live under hosts/.
Host Composition
Each machine is represented by a host directory or host module, which selects and specializes the shared module stack. Current targets include Istanbul and Vienna, with host-specific module files and generated reports:
• hosts/istanbul/istanbul.mod.nix
• hosts/vienna/vienna.mod.nix
• hosts/pala.mod.nix
Encrypted per-host credentials are colocated as Age files, such as hosts/istanbul/password.age and hosts/vienna/password.age.
Shared Nix Module Layer
modules/ is the primary declarative configuration layer. It defines OS, desktop, shell, packages, user management, networking, and application behavior, intended to be composed by hosts rather than run independently. Architecturally central modules include:
• System/user baseline: modules/home.mod.nix, modules/primary-user.mod.nix, modules/nix.mod.nix
• Platform-specific desktop behavior: modules/darwin-desktop.mod.nix, modules/darwin-wm.mod.nix, modules/hardware.mod.nix
• Boot and storage: modules/linux-boot.mod.nix, modules/disko.mod.nix
• Network and remote access: modules/network/network.mod.nix, modules/ssh.mod.nix, modules/dns.mod.nix
This indicates support for both Linux/NixOS-oriented and Darwin-oriented configurations.
Options and Reusable Libraries
Custom option schemas provide the public configuration contract consumed by modules and hosts:
• options/flake-outputs.mod.nix
• options/persist.mod.nix
• options/theme.mod.nix
• options/dns.mod.nix
Shared evaluation and generation logic is centralized in lib/, including system targeting, network/DNS utilities, and Rust-package support:
• lib/default.nix
• lib/systems.nix
• lib/network.nix
• lib/rust.nix
Secrets and Persistence Boundary
Secrets are deliberately separated from ordinary declarative configuration via Age-encrypted files and a root secrets declaration:
• secrets.nix
• modules/secrets.mod.nix
• modules/network/password.env.age
• modules/version-control/radicle.age
Host and module definitions should consume declared secret outputs rather than embed credentials. Persistence is modeled as a configurable concern through options/persist.mod.nix, likely supporting immutable or ephemeral-system patterns alongside modules/immutable-users.mod.nix.
Services and External Infrastructure
Service modules define managed system daemons and their integration with host configuration:
• services/base.mod.nix
• services/hickory-dns.mod.nix
• services/monerod.mod.nix
• services/managed-files.mod.nix
Material external/runtime concerns include DNS through Hickory DNS, Syncthing (modules/syncthing.mod.nix), SSH, network credentials, and a Monero daemon. These are system-service boundaries rather than an application-server architecture.
Custom Packages
packages/ builds locally maintained artifacts as flake/package outputs. It includes keyboard firmware, desktop utilities, proprietary-tool packaging, and a Rust executable:
• packages/corne-firmware/corne-firmware.mod.nix
• packages/fast-workspace-switch/fast-workspace-switch.mod.nix
• packages/matrix-imagepack-sync/matrix-imagepack-sync.mod.nix
packages/matrix-imagepack-sync/main.rs is the principal non-Nix application source, with Cargo metadata in its containing directory. Package modules integrate these artifacts back into the shared Nix configuration and outputs.
Main entry points: istanbul.mod.nix Host compositions · flake.nix Flake outputs · base.mod.nix Service integration · fast-workspace-switch.mod.nix Custom package modules
Components 19
Flake entry
- Flake outputs · Defines reproducible systems, environments, and package outputs.
flake.nix - Pinned inputs
flake.lock - Evaluation library · Shared system targeting, network, and Rust packaging logic.
lib/default.nix
Configuration layer
- Custom option contracts · Public schemas consumed by hosts and modules.
options/flake-outputs.mod.nix - Host compositions · Istanbul, Vienna, and Pala specialize the shared stack.
hosts/istanbul/istanbul.mod.nix - System and user baseline · Home, primary-user, and Nix baseline configuration.
modules/home.mod.nix - Platform desktop and hardware · Darwin desktop/window management and hardware behavior.
modules/darwin-desktop.mod.nix - Boot and storage · Linux boot and disk layout configuration.
modules/linux-boot.mod.nix - Network and remote access · Network, DNS, and SSH configuration.
modules/network/network.mod.nix
Secrets & persistence
- Persistence model · Configures persistent state for immutable or ephemeral hosts.
options/persist.mod.nix - Secret declarations · Maps encrypted credentials to consumable secret outputs.
secrets.nix - Age credentials · Host and module credentials remain encrypted at rest.
hosts/istanbul/password.age - Immutable users
modules/immutable-users.mod.nix
Managed services
- Service integration · Base wiring for managed system daemons.
services/base.mod.nix - Hickory DNS
services/hickory-dns.mod.nix - Monero daemon
services/monerod.mod.nix - Syncthing
modules/syncthing.mod.nix
Custom packages
- Custom package modules · Builds firmware, desktop utilities, and local applications.
packages/fast-workspace-switch/fast-workspace-switch.mod.nix - Matrix imagepack sync · Principal non-Nix application source packaged by the flake.
packages/matrix-imagepack-sync/main.rs
Connections 21
- Pinned inputs → Flake outputs: pins inputs
- Evaluation library → Flake outputs: evaluates outputs
- Custom option contracts → Flake outputs: defines output contract
- Flake outputs → Host compositions: builds targets
- Host compositions → System and user baseline: composes
- Host compositions → Platform desktop and hardware: specializes
- Host compositions → Boot and storage: configures
- Host compositions → Network and remote access: configures
- Custom option contracts → Persistence model: declares
- Host compositions → Persistence model: selects
- Persistence model → Immutable users: supports
- Age credentials → Secret declarations: encrypted inputs
- Secret declarations → Host compositions: provides secret outputs
- Host compositions → Service integration: enables services
- Service integration → Hickory DNS: manages
- Service integration → Monero daemon: manages
- Network and remote access → Hickory DNS: integrates DNS
- Host compositions → Syncthing: enables
- Custom package modules → Flake outputs: exports packages
- Matrix imagepack sync → Custom package modules: packaged as
- Custom package modules → System and user baseline: installs into environments