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
| Challenge | NixOS Solution |
|---|---|
| Configuration drift | Declarative: entire system defined in code |
| Failed updates | Atomic: rollback to previous generation |
| Reproducibility | Pinned: exact same system from same config |
| Remote management | Rebuild 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:
- Forge downloads NixOS ISO
- Writes ISO to USB with injected configs + polymerize.sh
- Operator boots target, runs polymerize.sh
- 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:
| Tier | Hardware | Status |
|---|---|---|
| Excellent | RPi 4B, x86 (MiniGMK, Q502L) | Upstream support, in active use |
| Good | RPi Zero 2W, T100TA (Bay Trail) | Working with constraints (512MB RAM, 32-bit UEFI) |
| Untested | RK3588 boards | Community flakes available |
See Hardware for specific board recommendations.
Key Modules
Styrene provides NixOS modules for fleet devices:
| Module | Purpose |
|---|---|
base.nix | Shared fleet config (users, SSH, packages, nix settings) |
batman-mesh.nix | BATMAN-adv mesh networking (styrene.mesh options) |
styrened.nix | Styrene daemon service (styrene.daemon options) |
cosmic-desktop.nix | COSMIC 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
- NixOS Manual
- NixOS on ARM
- gnull/nixos-rk3588 — RK3588 support flake
Related
- nix-docker-images — Building Docker images with Nix
dockerTools - Hardware — Supported devices
- styrened — Daemon running on NixOS fleet devices