my personal NixOS configuration
nix
  • Nix 93%
  • Shell 3.6%
  • CSS 3.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-18 18:42:07 +01:00
.forgejo/workflows ci: exclude trollshell from daily flake update 2026-10-27 07:38:47 +01:00
homeConfigurations undo :/ 2026-11-16 21:42:30 +01:00
homeModules distributed builds: add assertions, nix fmt 2026-05-03 16:13:47 +02:00
nixosConfigurations add agent-lab sandbox VM on muede-pc2 2026-11-18 18:42:07 +01:00
nixosModules disable solaar 2026-10-18 12:50:30 +02:00
.gitignore a big mess of specific service config 2024-02-23 22:31:46 +01:00
devices.nix add agent-lab sandbox VM on muede-pc2 2026-11-18 18:42:07 +01:00
flake.lock nix flake update (all) 2026-11-18 04:00:39 +01:00
flake.nix add truth machine 2026-10-18 03:36:15 +02:00
LICENSE Create LICENSE 2023-04-04 22:19:39 +02:00
nixosConfigurations.nix add preem bincache 2026-09-26 21:21:48 +02:00
README.md add agent-lab sandbox VM on muede-pc2 2026-11-18 18:42:07 +01:00

nixos-configuration

Personal NixOS configuration for all machines. Devices are declared in devices.nix, per-device configs live in nixosConfigurations/<name>/, and shared modules in nixosModules/.

Distributed builds

Machines are configured to act as build servers / binary caches for each other in devices.nix.

Onboarding a device as a build client

  1. Generate a key pair on the device:

    sudo ssh-keygen -t ed25519 -f /etc/nix/distributed-build-key -N "" -C "$(hostname)-nix-builds" && sudo cat /etc/nix/distributed-build-key.pub
    
  2. Add the public key to the device entry in devices.nix:

    distributedBuilds.clientPublicKey = "ssh-ed25519 AAAA... <hostname>-nix-builds";
    
  3. Rebuild all build machines so they pick up the new authorized key.

Adding a build server

  1. Add to its entry in devices.nix:

    distributedBuilds.isBuilder = true;
    distributedBuilds.hostPublicKey = "ssh-ed25519 AAAA..."; # from: ssh-keyscan -t ed25519 "$(hostname)"
    
  2. Generate a store signing key on the builder:

    sudo nix key generate-secret --key-name "$(hostname)" | sudo tee /etc/nix/signing-key.sec | sudo nix key convert-secret-to-public
    
  3. Add the printed public key to devices.nix:

    distributedBuilds.storeSigningPublicKey = "<hostname>:<base64...>";
    
  4. Rebuild all machines so they trust the new signing key.

agent-lab sandbox VM

agent-lab is a throwaway NixOS VM on muede-pc2 for hyperhive agents to ssh into and apply risky configs to. The host (nixosConfigurations/muede-pc2/agent-lab-vm.nix) only seeds its disk and runs qemu — it never declares the guest's system, so the guest can nixos-rebuild switch itself freely.

  • Reachable at muede-pc2:2222 (qemu user-mode NAT forward), root ssh only, authorized for the lpt2 and pc2 keys plus muede-pc2's build key.
  • sudo agent-lab-reset [flake-ref] rebuilds the seed image, replaces the disk, and restarts the VM. Takes seconds once the image is in the store. Defaults to the upstream flake; pass a local path to test uncommitted work.
  • /etc/nix/netrc is copied in over ssh on every VM start by agent-lab-vm-netrc.service, so the private cache credential stays out of the nix store. The host needs /etc/nix/distributed-build-key for this.
  • The guest's own config is nixosConfigurations/agent-lab/; it is the seed only. Whatever the agents switch to afterwards is not tracked here.