NixOS flake - heimdall, thor, loki, vidar
  • Nix 73.5%
  • Go 25.2%
  • QML 1.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
npilosov 205b9c767f
All checks were successful
Check / check (push) Successful in 7m27s
bar: highlight dock icons on hover and press them in on click
A dock icon now gets a tile behind it while the pointer is over it, in
the inactive window border colour. While a button is held the tile
turns the active border colour and the icon shrinks to 92%. That is the
size Hyprland's "popin 92%" window animation starts from, and the
number is read from that setting. The tile fills the icon's box with
the window corner radius: the icons sit as far inside the dock's inner
edge as windows sit inside the main pill, so the tile corners run
parallel to the dock's the way window corners run parallel to the
pill's. With Papirus, round and folder icons get a full tile and foot's
square icon gets a thin ring.

Hover, press and the dock slide all use the slide duration and curve,
now one Ease component (a PropertyAnimation, so it animates both colour
and numbers) in place of the inline NumberAnimation.

The dock is now a child of the reveal zone. In Qt 6.12, once
QQuickDeliveryAgentPrivate::deliverHoverEventRecursive finds a hovered
item with a HoverHandler, it passes hover only to that item's ancestors,
never to siblings beneath it. With the icons' new HoverHandlers, the
zone, a sibling of the dock, lost hover the moment the pointer reached
an icon, and the dock hid under it. Nested in the zone, the dock's
icons have the zone as an ancestor. dock.box maps the dock back into the
bar's coordinates for the frame paths.

Tested 2026-11-16 in a nested Hyprland 0.57.2 with quickshell 0.3.2 and
two foot windows. Hovering LibreWolf, foot and Nautilus in turn moved
the tile from icon to icon while the dock stayed up. Two clicks on foot
alternated focus between its windows, and the dock hid once the cursor
left. The windows stayed 774x836. The pointer was moved with wlrctl's
relative moves, because a hyprctl warp within one surface sends no
motion. wlrctl cannot hold a button, so the pressed look was checked
by forcing Steam's pressed state in a test copy. A real held press was
not tried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 06:57:35 +03:00
.forgejo ci: leave cache.numtide.com out of Check's substituters 2026-11-13 05:19:35 +03:00
docs caco-zero-three: record the whole 2026-11-11 outage, not only the disk failure 2026-11-14 11:04:03 +03:00
flake ai: opencode 2 on caco's vLLM endpoint, and drop the crush package 2026-11-15 00:33:55 +03:00
hosts llm-profiles: deleted comments 2026-11-15 13:20:23 +03:00
lib hermes: cut caco's deployment down to what still does something 2026-11-12 11:04:53 +03:00
modules hyprland: go back to dwindle tiling on thor and loki 2026-11-14 19:09:57 +03:00
overlays nixpkgs: take dufs and matrix-tuwunel from the previous nixpkgs too 2026-11-13 04:16:59 +03:00
packages fleet-check: evaluate etc-immutable alone, with the host builds 2026-11-13 17:24:49 +03:00
roles bar: highlight dock icons on hover and press them in on click 2026-11-16 06:57:35 +03:00
secrets heimdall: run kanidm-mail-sender through vidar's Stalwart 2026-11-14 16:12:08 +03:00
services kanidm: give every account matrix and jellyfin, the rest by hand 2026-11-14 17:09:30 +03:00
sites forseti: let the agent log in as dron over ssh 2026-10-30 11:37:49 +03:00
tests ai: opencode 2 on caco's vLLM endpoint, and drop the crush package 2026-11-15 00:33:55 +03:00
.betterleaks.toml hermes-native: whitelist the test dashboard password for betterleaks 2026-09-18 16:09:23 +03:00
.gitignore make the pre-commit hook self-healing 2026-09-16 09:23:20 +03:00
.golangci.yml go: lint both modules with golangci-lint, and fix what it found 2026-09-22 11:40:39 +03:00
.sops.yaml backups: move restic credentials into each end's own host secrets file 2026-11-09 15:25:22 +03:00
AGENTS.md caco-zero-three: take nccl and libnvshmem from a pinned nixpkgs 2026-11-12 13:49:06 +03:00
CLAUDE.md agents: write down the repo's patterns for people and their agents 2026-09-22 11:30:51 +03:00
flake.lock nixpkgs: take dufs and matrix-tuwunel from the previous nixpkgs too 2026-11-13 04:16:59 +03:00
flake.nix nixpkgs: take dufs and matrix-tuwunel from the previous nixpkgs too 2026-11-13 04:16:59 +03:00
README.md ai: take claude-code, codex and crush from llm-agents.nix 2026-11-12 10:47:54 +03:00
statix.toml Initial commit 2026-07-06 15:11:32 +03:00

nix-desktop

One NixOS flake for the whole fleet: its services, an AmneziaWG mesh, self-hosted DNS, sops secrets split by trust boundary, and deploys that roll an unhealthy host back on their own. How to change it is in AGENTS.md.

Host Kind Runs
thor workstation Hyprland, work VPN, gaming
loki laptop Hyprland, work VPN
heimdall home server, mesh hub media, Forgejo and CI, Matrix, observability, backups
vidar VPS, reached over VLESS/REALITY DNS, DoH, TURN, mail, backup target
bifrost VPS AmneziaWG gateway
magni Anbernic RG353V AArch64 SD image, RetroArch
forseti dron's second machine home PC, headless NixOS on a Ryzen 3 2200G; backup target for caco-zero-three, outside the mesh
caco-zero-three tenant-owned GPU server LLM stack, Hermes, Matrix, Kanidm, UPS shutdown; deployed separately
modi Pixel 9 Pro XL native AArch64 NixOS, Phosh, Btrfs on userdata

Each host starts at hosts/<host>/default.nix, which imports its composition.nix.

Layout

flake.nix    inputs and the list of flake-parts modules
flake/       one module per output kind: hosts, packages, checks, dev
hosts/       inventory.nix and one directory per host
sites/       operator and tenant identity: user, keys, domains, Wi-Fi
modules/     base.nix, shared options and behaviour, web service registry
roles/       capabilities a host composes
services/    one directory per service
lib/         fleet construction, typed inventory, mesh topology
packages/    flake packages; the Go tools are in command-suite
tests/       checks, registered in flake/checks.nix
secrets/     sops files

How a host is built

Fleet construction supplies modules/base.nix and hosts/<host>/default.nix. The host imports composition.nix, a normal NixOS module listing its roles and services. Host-specific service modules import the shared service beside their overrides. Check a reorder with nix run .#nix-eval-and-diff -- --contents <host>.

hosts/inventory.nix holds only mesh membership and deployment. lib/inventory.nix types it and checks the fleet-wide invariants, and lib/topology.nix derives the mesh subnet, peer lists and internal DNS from it. Hosts read the results as config.nd.fleet and config.nd.topology. Every inventory host is a node of one Colmena hive, and nixosConfigurations is that hive's nodes.

Roles

Roles import the roles they build on. Put a package in the narrowest one; tests/software-stack.nix enforces the boundaries.

Role Adds Imports
cli fish, Git, small shell tools
workstation credentials, TPM-backed SSH and signing cli
development compilers, language servers, Podman workstation
operations AWG, DNS, SOPS and storage tools workstation
ai coding agents from llm-agents.nix, and its binary cache workstation
desktop Hyprland session and default apps workstation
work mail, VPN, employer certificates workstation
gaming Steam, emulators, image-quality layers desktop
server bash, headless diagnostics, server health checks
reverse-proxy Caddy, ACME, web health checks and hardening

Services

A service is enabled by listing it in a host's composition.nix, so it has no enable flag of its own. To find out whether another service is present, a module asks that service's upstream option, such as config.services.forgejo.enable.

A host serving websites lists roles/reverse-proxy in its composition alongside roles/server. Gateways that do not serve websites need only server.

A service behind Caddy declares itself once, and its vhost, hardening floor, deploy health check and dashboard follow. The fields are documented in modules/web/options.nix:

nd.services.web.jellyfin = {
  port = 8096;
  unit = "jellyfin";
  job = "jellyfin";
  health = "/health";
  probed = true;
  hardening = "runtime";
  blockMetrics = true;
};

With required = true, a failing health check rolls the deploy back. Set it only for services whose loss costs access to the host or the ability to deploy, such as Forgejo. gate = { }; puts the vhost behind a Kanidm login, and gate.except or gate.only exempt paths whose clients cannot follow an OAuth redirect.

A service with state worth keeping lists that state in nd.backups.state.<name>.paths. Each contract selects a backup job, defaulting to nd.backups.defaultJob. The host imports services/backups and declares nd.backups.jobs.<name> with runtime repositoryFile and passwordFile paths, an optional environmentFile, and any unit dependencies needed to reach it. The job derives its paths, quiesced units, integrity checks and restore checks from its assigned contracts. A declaration without a consuming job fails evaluation, even when the backup service is absent. An explicit excludeReason instead reports a warning and makes no claim of backup coverage. Current exclusions and the steps to close them are in docs/flake-contracts-2026-10-27.md. caco-zero-three's destination is forseti's Western Digital disk, reached over the home LAN through a tenant-owned restic repository whose credentials live in each end's own host secrets file.

OAuth integrations declare nd.services.oauthClients.<client> beside the application, with its callbacks, landing URL, scope maps and secret reference. services/kanidm consumes the registry. Confidential clients get a runtime SOPS secret from this host's encrypted file; public clients require PKCE and have no secret. Web gates declare their clients through the same registry.

Caco's checkpoint manifests in hosts/caco-zero-three/llm/profiles.nix pin repository revisions and each file's byte size and SHA-256. The downloader checks installed files, resumes downloads into .part files, and renames a download into place only after its hash matches. The projector can come from a different repository while retaining its existing model-directory path.

Deploying

nix run .#deploy -- <host|all> [build|dry-activate|health|switch] [--reboot]
nix run .#deploy-caco -- all switch
nix run .#rebuild-current          # the machine you are on, through nh

switch is the default goal. It runs the current generation's own health probes first, then builds and dry-activates the whole selection, then switches the hosts one at a time. Before each activation it arms a timer on the target that restores the captured generation. The timer is cancelled only after /run/current-system is the expected closure and that closure's own probes pass. A host that loses SSH partway through therefore rolls itself back.

A generation that changes systemd or the D-Bus implementation cannot switch live. --reboot installs it with boot, reboots the host, and rolls back if the host comes up unhealthy. --allow-busy skips the busy check (active LiveKit rooms), and unsafe-switch skips every check. To give a slow host more time, raise DEPLOY_ROLLBACK_TIMEOUT_SEC, DEPLOY_HEALTH_ATTEMPTS, DEPLOY_HEALTH_INTERVAL_SEC or DEPLOY_REBOOT_TIMEOUT_SEC. The code is in packages/command-suite and is tested by tests/deploy-safe-switch.nix.

deployment.tenant splits the hosts by owner. A tenant's hosts can be deployed only with that tenant's own command, so deploy all never reaches caco.

CI

CI runs on Forgejo on heimdall. Check (flake-check.yaml) runs lint and then fleet-check on every push, inside the forgejo-ci container; a newer push cancels an older run. Deploy and Deploy caco-zero-three are started by hand from the Actions tab. They run on heimdall's nix-deploy runner and refuse a commit whose newest Check run did not succeed. thor's fleet-check-aarch64.timer builds the ARM checks weekly under QEMU.

Each runner registers with a uuid/token pair. Mint the pair on the repository, never on the instance, because an instance runner takes jobs from every repository:

curl --fail https://git.nestoris.online/api/v1/repos/npilosov/nix-desktop/actions/runners \
  -H "Authorization: token $FORGEJO_TOKEN" \
  --json '{"name":"heimdall-nix","ephemeral":false}'

The uuid goes in services/forgejo/runner.nix. The token goes in secrets/hosts/heimdall.yaml as forgejo-runner-nix-token, or forgejo-runner-deploy-token for heimdall-deploy. The deploy SSH key is forgejo-deploy-ssh-key in the same file, and its public half is in sites/deploy-authorized-key.nix.

Secrets

Each host decrypts with its own SSH host key, and there is no shared age key. .sops.yaml lists the recipients of each file.

File Readable by Holds
secrets/common.yaml the fleet, not caco password hash, DoH token, AWG gateway key
secrets/mesh.yaml every mesh member the mesh's AWG header key
secrets/desktop.yaml thor, loki Wi-Fi
secrets/work.yaml thor, loki work, mail, GitLab, Forgejo and Jira credentials
secrets/cluster.yaml heimdall, vidar backup and TURN credentials
secrets/turn-caco.yaml heimdall, caco caco's TURN secret
secrets/hosts/<host>.yaml that host its own keys and service credentials

To re-key a host after its SSH key changes, convert the new public key with ssh-to-age, replace the host's recipient in .sops.yaml, and run sops updatekeys on every file the host reads.

DNS

systemd-resolved -> dnsproxy -> Caddy DoH on vidar -> Blocky -> Knot Resolver

vidar queries its local Blocky directly. The work VPN's DNS servers take precedence for office domains because of their routing domains. On the home LAN, hosts find each other over resolved's mDNS on nd.host.network.mdnsInterfaces, and no host runs Avahi.

New host

  1. Write hosts/<host>/default.nix. It imports ./hardware.nix (from nixos-generate-config --show-hardware-config) and the host's sites/ module, if it has one, and it pins nd.meta.stateVersion.{system,home}.
  2. Write hosts/<host>/composition.nix with imports, and import it from the host's default.nix.
  3. Add the host to hosts/inventory.nix. Set deployment.enable = true if it should be deployable.
  4. If the host has a disks.nix, run nix run github:nix-community/disko -- --mode disko hosts/<host>/disks.nix. Then install with nixos-install --flake .#<host>.

Recovery

nix build .#installer builds an ISO with SSH, iwd, disko and git. If these secrets are decrypted first, the ISO joins the mesh as bootstrap (10.90.100.8) and connects to the office Wi-Fi. The secrets are embedded in the image, so delete it after use.

sops decrypt --extract '["mesh-private-key"]' secrets/hosts/bootstrap.yaml > /tmp/nix-bootstrap-mesh.key
sops decrypt --extract '["awg-header-protection-key-mesh"]' secrets/mesh.yaml > /tmp/nix-bootstrap-mesh-header.key
sops decrypt --extract '["eap-password"]' secrets/work.yaml > /tmp/nix-bootstrap-wifi-eap.key
nix build .#installer --impure

nd.meta.bootstrap = true turns off everything that needs secrets. Use it until the host has its sops identity back, either by restoring its old /etc/ssh/ssh_host_ed25519_key or by re-keying it as described under Secrets.

modi

Its first switch has to run on the phone. A fresh nix-on-droid ships a proot that is too old for this flake's glibc, so stage the pinned one from inside the app first:

p=/nix/store/dvf2ck9bkw7yyrlkjk87xz1anaxsgrd6-proot-termux-static-aarch64-unknown-linux-android-unstable-2026-02-20
nix-store -r "$p" && cp "$p/bin/proot-static" /bin/.proot-static.new

Restart the app, then run nix-on-droid switch --flake <checkout>#modi. This takes about half an hour. After that, build on thor with nix run .#modi-switch -- <phone address>; the phone's sshd listens on port 8022. Over USB, run adb forward tcp:8022 tcp:8022 and use 127.0.0.1. Over Wi-Fi, exclude com.termux.nix from the phone's VPN tunnel.

Pixel phone

modi is the native Pixel 9 Pro XL host. Its reproducible kernel, boot images, firmware provisioning and Btrfs installation are documented in docs/modi.md.