Self-sovereign infrastructure platform with secure, encrypted NixOS deployments
Version: 1.0 Date: 2025-11-03
Keystone uses a VM-based testing workflow for validating deployments and testing features. This document describes the automated testing scripts and common workflows.
Purpose: Full VM deployment testing (fresh install)
What it does:
.#test-serverUsage:
./bin/test-deployment # Normal test run
./bin/test-deployment --rebuild-iso # Rebuild ISO first
./bin/test-deployment --hard-reset # Force VM cleanup
./bin/test-deployment --debug # Show full output
Time: 10-15 minutes (full redeploy)
Use when: Testing fresh installations, major changes, Secure Boot changes
Purpose: Incremental configuration updates (fast iteration)
What it does:
--build-host)Usage:
./bin/update-test-vm # Quick update (no reboot)
./bin/update-test-vm --reboot # Update and reboot
./bin/update-test-vm --build-host # Build on VM (slow network)
Time: 1-3 minutes
Use when: Iterating on module changes, testing configuration updates
Preserves: All VM state (enrolled keys, data, TPM enrollment)
Purpose: VM lifecycle management
What it does:
Usage:
./bin/virtual-machine --name test-vm --start # Create and start
./bin/virtual-machine --post-install-reboot test-vm # Post-install cleanup
./bin/virtual-machine --reset test-vm # Complete removal
./bin/virtual-machine --reset-setup-mode test-vm # Reset Secure Boot
Network: VMs connect to keystone-net with static IP 192.168.100.99
Purpose: Build Keystone installer ISO with optional SSH keys
What it does:
.#isoresult → ISO fileUsage:
./bin/build-iso # No SSH keys
./bin/build-iso --ssh-key ~/.ssh/id_ed25519.pub # With SSH key
./bin/build-iso --ssh-key "ssh-ed25519 AAA..." # Direct key string
# Deploy fresh system
./bin/test-deployment
# SSH in
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.100.99
# Test feature (e.g., TPM enrollment)
sudo keystone-enroll-recovery --auto
# Verify
sudo reboot
# System should unlock automatically via TPM
# Make changes to module
vim modules/tpm-enrollment/default.nix
# Quick update to VM (preserves state)
./bin/update-test-vm
# SSH and test
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.100.99
sudo keystone-enroll-recovery --auto
# Repeat as needed
# Make boot-related changes
vim modules/disko-single-disk-root/default.nix
# Update and reboot
./bin/update-test-vm --reboot
# Verify boot behavior
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.100.99
# Clean slate
./bin/test-deployment --hard-reset --rebuild-iso
# Fresh deployment with latest changes
.#test-server (flake.nix)keystone-test-vm192.168.100.99 (static)keystone-net (libvirt network)/dev/vda (20GB default)modules/server - Base server configurationmodules/disko-single-disk-root - ZFS + LUKS encryptionmodules/secure-boot - Secure Boot with lanzabootemodules/initrd-ssh-unlock - Remote disk unlockmodules/tpm-enrollment - TPM enrollment (enabled by default)ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.100.99
Test VMs are recreated frequently, causing:
These options:
./bin/test-deployment - verify fresh deployment worksssh root@192.168.100.99 'nixos-rebuild switch --rollback'--rebuild-iso to ensure ISO build works# Check VM status
virsh list --all | grep keystone-test-vm
# Check libvirt network
virsh net-list | grep keystone-net
# View serial console
virsh console keystone-test-vm
# Check logs
virsh dumpxml keystone-test-vm
# Check VM IP
virsh domifaddr keystone-test-vm
# Verify network
virsh net-dhcp-leases keystone-net
# Try serial console instead
virsh console keystone-test-vm
# Check if waiting for disk unlock
virsh console keystone-test-vm
# Look for password prompt
# Manually unlock via serial console
# Enter: keystone
# Rollback on VM
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.100.99
sudo nixos-rebuild switch --rollback
# Or reset and redeploy
./bin/virtual-machine --reset keystone-test-vm
./bin/test-deployment
IMPORTANT: When modifying testing scripts, update this document to reflect:
Testing scripts to keep in sync:
bin/test-deploymentbin/update-test-vmbin/virtual-machinebin/build-isobin/virtual-machine --helpdocs/examples/vm-secureboot-testing.mddocs/tpm-enrollment.mdspecs/*/test-plan.mdDocument Version: 1.0 Last Updated: 2025-11-03 Maintainer: Keystone Project