Skip to Content
DocumentationArchitecture

System Architecture

Monorepo structure, component boundaries, and tech decisions.

Monorepo Layout

floppy.wtf/ ├── nixos/ # NixOS system definitions │ ├── flake.nix # Build manifest (pinned inputs) │ ├── flake.lock # Dependency lock │ ├── hosts/ # Per-machine configurations │ │ └── dell/ │ │ ├── configuration.nix # Host-specific system config │ │ └── hardware-configuration.nix │ ├── modules/ # Reusable NixOS modules │ │ ├── base.nix # Core system (networking, users, SSH) │ │ ├── filesystem.nix # Btrfs layout + snapshots │ │ ├── desktop.nix # DE/WM selection │ │ ├── power.nix # TLP + power tuning │ │ └── networking.nix # WireGuard, Syncthing, Avahi │ ├── theme/ # Visual identity modules │ │ ├── colors.nix # Central color palette │ │ ├── fonts.nix # Font packages + fontconfig │ │ ├── applenix.nix # macOS-rivaling theme │ │ └── matrix.nix # Matrix mode theme │ └── roles/ # Role-based compositions │ ├── dev.nix # Developer workstation │ ├── node.nix # Infrastructure node │ ├── minimal.nix # Bare minimum │ └── lab.nix # Experimentation ├── cli/ # floppy CLI tool │ ├── src/ │ │ ├── main.ts # Entry point │ │ ├── commands/ # CLI command handlers │ │ ├── registry/ # Device registry storage │ │ └── lib/ # Shared utilities │ ├── package.json │ └── tsconfig.json ├── web/ # Website + documentation │ ├── app/ # Next.js app router │ ├── content/ # MDX documentation │ └── package.json ├── assets/ # Shared assets ├── registry/ # Device registry data (gitignored) ├── specs/ # Specifications └── .gitignore

Component Boundaries

NixOS Configurations (nixos/)

Responsibility: Define deterministic system states.

  • Pure Nix language
  • No imperative scripts
  • Flake-based with pinned inputs
  • Evaluated locally or on target machine
  • Produces bootable system closures

Depends on: Nothing (self-contained Nix evaluation)

CLI Tool (cli/)

Responsibility: Operational workflows — registration, provisioning, fleet.

  • TypeScript + Bun runtime
  • Commander.js for CLI framework
  • SQLite for local device registry
  • SHA256 for content addressing
  • Shells out to Nix commands for provisioning

Depends on: nixos/ configs (references flake for provisioning)

Device Registry (registry/)

Responsibility: Persistent device identity + evidence storage.

  • Gitignored (contains binary artifacts + device-specific data)
  • JSON records per device
  • Content-addressed evidence store
  • Queryable via CLI

Depends on: CLI tool writes here

Tech Stack

ConcernChoiceRationale
OS DefinitionNixOS + FlakesDeterministic, reproducible, hash-addressed
Package Pinningflake.lockExact dependency versions
FilesystemBtrfsCoW, checksums, snapshots, low overhead
DesktopXFCE (default)Lightweight, GPU-safe for old hardware
CompositorPicomSubtle effects without GPU strain
CLI RuntimeBun + TypeScriptFast, modern, good DX
CLI FrameworkCommander.jsStandard, well-documented
Local DBSQLiteZero-config, embedded, reliable
HashingSHA256Industry standard, Nix-compatible
File TransferLocalSendAirDrop-like, cross-platform
SyncSyncthingContinuous, decentralized, integrity-aware
VPN MeshWireGuardModern, fast, simple
DiscoveryAvahi (mDNS)Standard LAN discovery

Data Flow

Device Registration Flow

Physical Device floppy device register --model "Dell ..." --serial "..." ├── Creates device record (JSON) ├── Assigns device ID (FLOPPY-{TYPE}-{SEQ}) └── Stores in registry/devices/{id}.json floppy device attach-photo {id} ./photo.jpg ├── Strips EXIF metadata ├── Computes SHA256 ├── Stores in registry/evidence/{hash}.jpg └── Updates device record with evidence reference

Provisioning Flow

Registered Device floppy provision {device-id} --role dev ├── Resolves role → NixOS host config ├── Generates hardware-specific overrides ├── Builds NixOS installer USB image └── Validates build closure Physical Flash (USB → Device) Boot → nixos-install --flake .#{host} Post-install verification ├── System hash verification ├── Service health checks └── Device status → "provisioned"

Security Model

ConcernApproach
Evidence integritySHA256 content-addressing
Config integrityNix store hash verification
Transport securityWireGuard encrypted mesh
File transferTLS via LocalSend
Registry accessLocal-only (no remote API in early phases)
SecretsNever committed; managed via agenix or sops-nix
Last updated on