VM Development Workflow (dev-sync)
The ./scripts/dev-sync script enables rapid iteration on NixOS configuration using a VM.
Setup
- •Copy
.env.exampleto.env:
bash
cp .env.example .env
- •Configure VM connection in
.env:
code
VM_HOST=192.168.122.3 VM_USER=altan VM_PASS=test
Commands
bash
# Sync files only (no rebuild) ./scripts/dev-sync sync # Sync + rebuild NixOS ./scripts/dev-sync rebuild # Sync + run flake check ./scripts/dev-sync check # Open SSH session to VM ./scripts/dev-sync ssh
How It Works
- •Rsyncs files to
~/nixos-syncon VM (as user) - •Sudo rsyncs to
/etc/nixos(preserves .git) - •Auto-commits changes for flake compatibility
- •Runs requested command (rebuild, check, etc.)
Important: Flake + Git
NixOS flakes require files to be git-tracked. The script:
- •Preserves
.gitdirectory on VM - •Auto-initializes git repo if missing
- •Auto-commits changes before rebuild
Common Workflows
Test configuration changes
bash
# Make changes locally, then: ./scripts/dev-sync rebuild
Restart services without logout
bash
# After rebuild, restart specific service: sshpass -p 'test' ssh altan@192.168.122.3 'systemctl --user restart noctalia-shell'
Full test cycle
bash
./scripts/dev-sync rebuild && \ sshpass -p 'test' ssh altan@192.168.122.3 'systemctl --user restart noctalia-shell'
Check for errors before rebuild
bash
./scripts/dev-sync check
Verification Commands
Run on VM via SSH:
bash
# Check service status sshpass -p 'test' ssh altan@192.168.122.3 'systemctl --user status noctalia-shell' # Check generated config sshpass -p 'test' ssh altan@192.168.122.3 'cat ~/.config/noctalia/settings.json | jq .' # Check noctalia runtime state sshpass -p 'test' ssh altan@192.168.122.3 'noctalia-shell ipc call state all | jq .'
Troubleshooting
"path does not exist" errors
- •Files must be git-tracked for flakes
- •Script auto-commits, but check if new directories are added
Build fails on VM but works locally
- •VM may have different nixpkgs version
- •Check flake.lock is synced
Services not restarting
- •Use
systemctl --user restart <service> - •Or logout/login for full reload