NixOS

Type: Operating System Role in Styrene: Fleet device operating system

NixOS is a Linux distribution built on the Nix package manager, providing declarative configuration and atomic upgrades.

Why Styrene Uses NixOS

ChallengeNixOS Solution
Configuration driftDeclarative: entire system defined in code
Failed updatesAtomic: rollback to previous generation
ReproducibilityPinned: exact same system from same config
Remote managementRebuild remotely via nixos-rebuild --target-host

Declarative Configuration

A NixOS system is defined by a single configuration.nix (or flake):

{
  networking.hostName = "fleet-node-01";

  styrene.mesh = {
    enable = true;
    meshId = "styrene";
  };

  services.styrened = {
    enable = true;
    hubAddress = "<hub-identity-hash>";
  };
}

Changing configuration and rebuilding produces a new system generation.

Styrene Fleet Pattern

┌─────────────────────────────────────────┐
│  styrene-edge repository                │
├─────────────────────────────────────────┤
│  sbc/                                   │
│  ├── flake.nix                          │
│  │   ├── nixosConfigurations.rpi4       │
│  │   └── nixosConfigurations.rpi-zero2w │
│  ├── common/                            │
│  │   ├── base.nix       (styrene.base)  │
│  │   ├── batman-mesh.nix (styrene.mesh) │
│  │   ├── styrened.nix   (styrene.daemon)│
│  │   └── cosmic-desktop.nix             │
│  ├── rpi4/configuration.nix             │
│  ├── rpi-zero2w/configuration.nix       │
│  ├── x86-generic/                       │
│  │   ├── configuration.nix              │
│  │   └── polymerize.sh                  │
│  └── t100ta/                            │
│      ├── configuration.nix              │
│      └── polymerize.sh                  │
│                                         │
│  forge/         (Styrene Forge TUI)     │
│  installs/      (runbook tracking)      │
└─────────────────────────────────────────┘

All fleet devices share common modules; device-specific configs add hardware support.

Image Generation

ARM SBCs (RPi 4, Zero 2W): Direct SD card images via Nix flake:

nix build ./sbc#packages.aarch64-linux.rpi4-sd
# Pre-built images available from styrene.cachix.org

x86 devices: Styrene Forge prepares bootable USB media:

  1. Forge downloads NixOS ISO
  2. Writes ISO to USB with injected configs + polymerize.sh
  3. Operator boots target, runs polymerize.sh
  4. Device boots into NixOS and announces to fleet

Remote Updates

Once a device is in the fleet:

# Traditional (requires SSH)
nixos-rebuild switch --flake .#fleet-node-01 --target-host fleet-node-01

# Styrene way (uses LXMF, no SSH)
styrene-tui CONFIG_UPDATE RPC styrened nixos-rebuild

The Styrene approach works over mesh, offline-tolerant, no SSH keys needed.

Hardware Support

NixOS ARM support varies by board:

TierHardwareStatus
ExcellentRPi 4B, x86 (MiniGMK, Q502L)Upstream support, in active use
GoodRPi Zero 2W, T100TA (Bay Trail)Working with constraints (512MB RAM, 32-bit UEFI)
UntestedRK3588 boardsCommunity flakes available

See Hardware for specific board recommendations.

Key Modules

Styrene provides NixOS modules for fleet devices:

ModulePurpose
base.nixShared fleet config (users, SSH, packages, nix settings)
batman-mesh.nixBATMAN-adv mesh networking (styrene.mesh options)
styrened.nixStyrene daemon service (styrene.daemon options)
cosmic-desktop.nixCOSMIC desktop environment (styrene.desktop options)

Generations

NixOS keeps previous system generations:

# List generations
nixos-rebuild list-generations

# Roll back
nixos-rebuild switch --rollback

If a Styrene config update breaks a device, roll back via LXMF RPC.

Resources

Graph