NixRiot internals
Maintainer and agent notes. The user-facing manual is ../README.md; the
reasoning and roadmap are in Design.md. This file is the durable record of how
the system works and why, so it survives a clone.
Last updated: 2026-11-19.
Decisions, and why
- NixOS, not Arch or CachyOS. Reproducibility and supply-chain defensibility are the point. The README intro carries the history.
- Panacea is carried in-repo, not a flake input. First-party copies under
panacea/, no sync tooling. Every deliberate change from upstream goes inpanacea/LOCAL-CHANGES.md. Upstream work is ported by hand, never merged: our copy is a translated one, so a merge would conflict across roughly 194 files and hand the Russian comments back.panacea/UPSTREAMrecords the reviewed revision and moves only once a revision has been read, so nothing is reviewed twice and skipped work stays visible in Not yet changed. - One flake, with the machine’s files inside it. The installer writes
hosts/installed/local.nix(username, plus anynixriotoverrides) and generateshosts/installed/hardware-configuration.nix. Updates preserve exactly those two files. A separate per-machine flake was tried and reverted: it broke installs and bought nothing. - The live image is an installer, not a desktop. tty1 autologins as
nixosand runs the installer; the serial console (ttyS0) gives a plain shell. The installer runs only on tty1;iso/configuration.nixguards on$(tty). Without that guard every getty runs a copy, and two installers can both reach the target disk. - Network is required. The image is a netinstall: flake inputs plus a
pre-seed list ship inside it, everything else comes from
cache.nixos.org. There is no offline image. The installer will not touch a disk untilcache.nixos.organswers, and it offersnmtuiwhen it does not. - The pre-seed list is about distribution size, not install speed. The ISO must stay under GitHub’s 2 GiB per-asset limit. Pre-seeding trades a download for an xz-decompress plus a copy, so it does not obviously speed up an install, and for our own derivations it trades a build for a copy.
- UEFI only. systemd-boot, Secure Boot off. BIOS is not supported.
- No greeter.
nixriot.autologinlogs the user in; the lock screen is the gate. SDDM theme work was dropped for this reason. - Music is Lollypop. The pill reads MPRIS and nothing else;
mpdspeaks no MPRIS, sompd/rmpcwere removed. Images open in the pill’s own viewer (panacea-media.desktop), video inmpvwithmpvScripts.mpris. Audio MIME types are left unset so Lollypop wins from its own desktop entry. - Mullvad ships with its GUI. The pill’s VPN panel (
vpn.py) only reports: it lists NetworkManager profiles and detects tunnel interfaces (wg*,tun*, names starting withmullvad, …). It never connects. - Lock and the password vault need PAM
swaylock.security.pam.services.swaylockis set inmodules/desktop/panacea.nix;lock.qmlandshell.qmlboth usePamContext { config: "swaylock" }. - No default password, no default username. The installer asks for both.
- GlyphRiot and fingerprint are opt-in (
nixriot.crypto.glyphriot,nixriot.fingerprint.{enable,pam,tod}). - Zed is not installed. If it is wanted, it is a one-line option plus a
writable
~/.config/zed/settings.jsonso Panacea’spalette.shcan theme it. Helix and Crush are the defaults. - The screen locks itself after fifteen minutes idle. Upstream Panacea
ships a manual lock only; this is OpenRiot’s behaviour restored
(
xautolock -time 10), raised to 15 minutes.panacea/hypr/hypridle.conflocks through Panacea’s ownlock.shat 900s,hypr/lua/autostart.luastartshypridle, and Coffee mode still wins: it holds asystemd-inhibitforidle, which hypridle honours at its defaultignore_systemd_inhibit. Display-off is deliberately absent: Hyprland 0.56 replaced thedpmsdispatcher with Luahl.dpms, so there is no version-independent command. - Closing the lid is logind’s business. NixRiot does not bind the lid
switch at all: upstream bound it to a lock, which locked a machine that was
still in use on an external display. logind’s own rule does what is wanted:
more than one connected display counts as docked and
HandleLidSwitchDockedisignore, so a clamshell lid does not suspend, andmodules/nixriot.nixstates the three values explicitly so a logind default change cannot alter it. The lock happens on the way into suspend, from hypridle’sbefore_sleep_cmd. - Night light is a hyprsunset toggle, off by default. Ported from upstream
2d68047.panacea/scripts/nightlight.showns the filter (on [K],off->identity, 4000K like OpenRiot);shell.qmlowns the state, the schedule and the settings;SetDisplay.qmlandControlsView.qmlexpose it, andSUPER+Ntoggles it. The daemon starts bare at 6000K (hypr/hyprsunset.conf) instead of being forced to 5000K at boot, so the screen is neutral until you ask.hyprsunsetapplies the filter through CTM, so screenshots and recordings carry it. - Fingerprint stays opt-in, with a decided design for when it is not. All
three options are off today (
nixriot.fingerprint.{enable,pam,tod}), so the daemon is not even started and nothing can interfere with login. Omarchy does it at runtime instead, and that is the model to copy:- Detect the reader from sysfs, before fprintd exists. Match USB vendor IDs
(
27c6Goodix,138aValidity,06cbSynaptics,08ffAuthenTec,1c7aEgisTec,147eUpek) plus a vendor-independent product string (*fingerprint*,*biometric*,elan:arm-m4,fpc *). Reject a vendor match when a kernel driver is bound to any of the device’s interfaces: libfprint drives readers from userspace, so a bound driver means the vendor ID is shared with a webcam bridge or a touchpad.usbfsis the exception, since libusb claims an interface through it. Elan and STMicro are left out of the vendor list on purpose for the same reason. - Invite once, by notification, when a reader is present and nothing is enrolled.
- Leave PAM to nixpkgs, which installs
pam_fprintdwithcontrol = "sufficient"and exposessecurity.pam.services.<name>.fprintAuth. - Add the gate. With PAM on and the lid shut the reader is unreachable, so
pam_fprintdwaits for a finger that cannot arrive and only then falls through to the password. Omarchy putsauth [success=1 default=ignore] pam_exec.so quiet /usr/bin/omarchy-hw-laptop-closedimmediately before it, which skips exactly that one rule; its helper reads/proc/acpi/button/lid/*/stateand falls back to theSW_LIDbit in/sys/class/input/*/capabilities/sw. nixpkgs has no equivalent, so anything that turnsfprintAuthon must carry the gate itself.security.pam.services.<name>.rulesand its per-ruleorderare how to place it without editing PAM files.
- Detect the reader from sysfs, before fprintd exists. Match USB vendor IDs
(
- Panacea’s config is refreshed on every rebuild. It used to be copied only
when
~/.config/<tree>was absent, which meant a fix underpanacea/(a keybinding, a cursor, a script) reached a fresh install and nobody else. An upgrade rebuilt the system and left the desktop alone.home/panacea.nixnow rsyncs each tree with--deleteon every activation, so upgrading does what it says. What is not ours to ship is excluded:hypr/custom/(the override layer Panacea sources last, and where a user’s own changes belong),settings.json,clipboard_pins.jsonand.whatsnewunderpanacea/, andwallpaper.confandhyprpaper.conf, whichswitch_theme.shwrites as the wallpaper state.foot/andfastfetch/are refreshed whole becausepalette.shregenerates their theming later in the same activation. rsync is called by store path so activation does not depend on PATH. - Crypto holdings are not displayed yet. OpenRiot’s
~/.config/crypto.tomlheld coins, amounts and an optional API key, and its polybar module showed prices from CoinGecko when that file existed, refreshing on click. NixRiot ships the wallets but nothing reads holdings, so the feature was lost in the port. It maps onto the pill as it stands: ascripts/crypto.shthat parses the file and prints JSON, aProcessinshell.qmlpolling it the way the weather widget pollsweather.sh, one glyph and the total in the collapsed pill shown only when the file exists, and a page listing each holding that opens when that glyph is clicked. The file stays the user’s: never shipped, never in the ISO, and back in.gitignorewith a comment explaining why.
Verified package facts
Checked against nixpkgs. Do not re-add removed packages, and use these names.
| Package | Status |
|---|---|
lollypop |
present, 1.4.40; MPRIS; the music app |
mpvScripts.mpris |
present (mpv-mpris 1.3); makes video appear in the pill |
zed-editor |
present, 1.27.0; not installed. There is no zed package |
mpd, rmpc |
present, but removed from the system (no MPRIS) |
kora-icon-theme |
present; pulls breeze-icons.dev and Qt dev outputs |
mullvad / mullvad-vpn |
the CLI+daemon, and the Electron GUI |
intel-npu-driver, level-zero |
present; nixriot.npu wires them up |
kate |
not shipped: use kdePackages.kate if ever readded |
noto-fonts-cjk |
split: noto-fonts-cjk-sans, noto-fonts-cjk-serif |
noto-fonts-emoji |
renamed: noto-fonts-color-emoji |
noto-fonts-extra |
gone: use noto-fonts-lgc-plus |
gnome-disks |
renamed: gnome-disk-utility |
crush |
present, 0.101.0, fsl11Mit (unfree; allowUnfree is set) |
gurk-rs |
present, 0.10.2; the signal alias and its launcher entry |
quickshell |
present, 0.3.2 |
zeroad, frozen-bubble |
removed from nixpkgs |
Installer
installer/default.nixbuilds thenixriot-installscript. Run it withsudo nixriot-install.- Prompt order: username, hostname, password, network, disk,
ERASE, LUKS twice, install, reboot. It creates a 512M ESP labeledBOOTand the rest as LUKS2nixos,mkfs.ext4on the mapped volume, and mounts the ESP withfmask=0077,dmask=0077. - The passphrase is captured once into a temp keyfile and reused for
luksFormatandopen, so there are two prompts, not three. The account password is collected up front and applied at the end withchpasswd. - It copies
/etc/nixriotto/mnt/etc/nixriot, runsnixos-generate-config --root /mnt --dir /mnt/etc/nixriot/hosts/installed, writeslocal.nix, and runsnixos-install --root /mnt --flake /mnt/etc/nixriot#installed. - Everything is teed to
/tmp/nixriot-install.login the guest. When an install looks stuck, read that file over the serial console before guessing. - Environment:
NIXRIOT_USER,NIXRIOT_HOSTNAME,NIXRIOT_DISK,NIXRIOT_PASSPHRASE,NIXRIOT_PASSWORD,NIXRIOT_FLAKE,NIXRIOT_OFFLINE,NIXRIOT_REBOOT. SettingNIXRIOT_DISKmakes the whole run unattended;NIXRIOT_HOSTNAMEfalls back tonixriot.
Update path
modules/update.nixinstallsnixriot-updateand two systemd units.nixriot-update-check.timer:OnBootSec=5min,OnUnitActiveSec=4h,RandomizedDelaySec=10min,Persistent=false. It compares/etc/nixriot/VERSIONwithVERSIONon main, takes the one-line subject from the matching changelog section, and writes/var/lib/nixriot/status.json. It fails soft.VERSIONis the trigger, not the commit. A commit pushed to main without a version bump is invisible: the check sees the same version and reports nothing.make bumpexists for that, committing a newVERSION, its notes and the tag, without building an ISO or creating a release. The tag marks the version and the release marks the artifact, somake releaseafterwards publishes that same version instead of bumping past it. A hand-runnixriot-update applyfetches main at HEAD whatever the version, which is how unreleased work gets onto a machine during testing.nixriot-update.serviceis a privileged oneshot, startable bywheelthrough a polkit rule.apply:- clones upstream into a temp dir,
rsync -a --deleteinto/etc/nixriot, excludinghosts/installed/local.nixandhosts/installed/hardware-configuration.nix,- writes the new revision to
/etc/nixriot-revision, nixos-rebuild switch --flake /etc/nixriot#installed,- writes
/var/lib/nixriot/release-notes.txtfrom the changelog sections above the installed version, falling back togit logsubjects only if the changelog is unreadable or the old version is unknown.
/etc/nixriot-revisionis a real file, written by the installer and the updater. It is not derived from the flake: the machine’s tree is evaluated as a path input, which has noself.rev. On the ISO,environment.etc."nixriot-image-revision"carries the build-time revision and the installer copies it into place.panacea/scripts/update.shis the adapter between Panacea’s update UI andnixriot-update:checkanswers in key=value from the status file,applystarts the service and writes~/.config/panacea/.whatsnew.
Releases
VERSIONis the single source of truth: two parts,1.0, then1.1, then2.0. Minor is the normal release, major is deliberate, and there is no patch level, so fixes ship as the next minor.CHANGELOG.mdholds short hand-written notes, newest first, one## <version>heading per release matchingVERSION. Work in progress goes under## Unreleased.- The installed system reads its own copies,
/etc/nixriot/VERSIONand/etc/nixriot/CHANGELOG.md, so no stamp file is involved: an update replaces both files with the tree. nixriot-update checkfetches both fromraw.githubusercontent.com/<repo>/mainand compares the versions. It does not use the GitHub API, so there is no rate limit and no commit-hash comparison. A commit that does not bumpVERSIONis not offered to anyone.status.jsonkeeps its shape, so the pill shows1.0 -> 1.1:installedandavailablecarry versions, andsubjectis the first bullet of the new version’s entry.- The notes a machine shows are the changelog sections above its own version,
sliced by
nixriot-update applyand written to/var/lib/nixriot/release-notes.txt.panacea/scripts/update.shturns that into~/.config/panacea/.whatsnew, with the version as the first line. If the changelog is missing or the installed version is unknown, the notes fall back to commit subjects from the clone. - Publishing (bump, guards, editor prompt, tag, ISO build,
SHA256SUMS,gh release create) ismake releaseandmake publish. The mechanics and the rules are inAGENTS.mdunder Releasing.
Testing in QEMU
qemu-system-x86_64 -enable-kvm -machine q35 -cpu host -smp 4 -m 8G \
-drive if=pflash,format=raw,readonly=on,file=<OVMF_CODE.fd> \
-drive if=pflash,format=raw,file=<copy of OVMF_VARS.fd> \
-vga std -display gtk \
-chardev socket,id=ser,path=<vm>/serial,server=on,wait=off,logfile=<vm>/serial.log \
-serial chardev:ser \
-cdrom result/iso/NixRiot.iso -boot order=d,menu=on \
-drive file=<vm>/disk.qcow2,if=virtio,format=qcow2 \
-netdev user,id=n0 -device virtio-net-pci,netdev=n0
- Run the window under XWayland:
GDK_BACKEND=x11with-display gtk. On native Wayland the gtk client repaints only when it gains or loses focus, so typing looks dead until you flick focus away and back; under X11 it repaints on every keystroke. The window class tells you which you got:qemuis the native Wayland client,Qemu-system-x86_64is the X11 one.gtk,gl=onfails outright (GtkGLArea console lacks DMABUF support).-display sdlis worse than either: it produced no host window at all, and the guest ran headless with nothing on screen to say so. - The gtk window often comes up smaller than the guest’s console, so text runs
off the right edge and looks like a broken install.
View -> Zoom to Fitin the window scales it; the setting is not remembered between runs. - Copy
OVMF_VARS.fdout of the store before use andchmod u+wthe copy: the store’s copy is read-only, and QEMU exits withPermission deniedon it. - Keep VM files under
~/vms, never/tmp:/tmpis tmpfs, and a qcow2 there consumes RAM until the backing store fails with EIO inside the guest. cache=unsafeand a fresh qcow2 per run make installs noticeably faster.- The serial console is a
bashshell (ttyS0); the installer runs on tty1. Use it to read the guest’s install log:printf 'cat /tmp/nixriot-install.log\n' | socat -u - UNIX-CONNECT:<serial socket>Pace the input: the guest’s tty drops bytes if the command arrives too fast.
Known risks
- Panacea tracks Hyprland and Quickshell closely. nixpkgs carries Quickshell
0.3.2. Panacea’s QML imports
QtMultimedia; without it on the QML import path (modules/desktop/panacea.nix) the shell refuses to load.QML2_IMPORT_PATHandQML_IMPORT_PATHare both set forqtmultimedia. QtWebEnginewas deliberately removed. Panacea reaches it only throughLoader { source: "IslandWebView.qml" }, so the shell loads without it and only the chat page breaks. Verified by running the shell headlessly.- The ISO carries the repo, so any repo change needs an ISO rebuild before an installed system can see it.
- Panacea’s scripts assume Arch paths in a few places; audit each feature as it
is exercised.
palette.shrewrites~/.config/{fastfetch,foot,fish,zed,btop,…}at run time, so those files must stay writable copies, never Home Manager store symlinks. hardware.firmwareismkForced to a trimmed list inmodules/nixriot.nix; anything that adds firmware must be appended there.- Cosmetic
buildEnvcollisions exist forgvfsandbitcoind(duplicates).
Why installs are slow: fish completions
programs.fish.generateCompletions defaults to true and, for every package
in the profile, creates a <package>_fish-completions derivation with
runCommandLocal (nixos/modules/programs/fish.nix). runCommandLocal is
never substituted from a binary cache, so every install builds hundreds of
tiny derivations locally, one after another. A slow install looks like it has
hung on whichever one is currently building. It was seen on
kora-icon-theme_fish-completions, which is confusing because kora itself is
pre-seeded and already in the store.
We enable it implicitly with programs.fish.enable = true in
modules/apps/shell.nix.
Fix: programs.fish.generateCompletions = false;. The cost is completions
derived from man pages, and we ship no man pages. Decision pending a full
install run.
Open questions
docs/Design.mdstill describes the old installer flow, old milestones, and the old ISO-size risk.