1.9 KiB
NixOS GitOps Bootstrap Guide
This repository is designed to be fully automated once bootstrapped. We separate concerns into two layers:
- Host Layer: Bare-metal hardware setup on Proxmox.
- Workload Layer: VMs and network resources.
1. Apply the Host Layer
Before deploying VMs, you need to prepare the Proxmox host (setup ZFS, disable NIC offloading, etc.).
- Clone this repository to your laptop.
- Run the host-layer apply script using Docker (requires Docker installed):
./scripts/apply-host-layer.sh - OpenTofu will prompt you for variables like the target
node_ip, yourssh_user, and thedata_disk_id(e.g.nvme-eui...) to format as ZFS.
2. Prepare the Golden Image
Because the GitOps Control Center must be spun up fully configured without human intervention, you need a pre-built NixOS .qcow2 image.
- Build the golden image locally (requires Nix/WSL):
nix run github:nix-community/nixos-generators -- --flake ./nixos#izanagi --format qcow - Upload the resulting
.qcow2file to your Proxmox node. - Create a new VM in Proxmox with ID 9000.
- Import the
.qcow2as its disk and convert the VM into a Template. (Ensure the template has Cloud-Init configured).
3. Deploy the Workload Layer
Once the host is prepped and the template exists, you can deploy the base workloads (like the GitOps Control Center).
- Change to the workload-layer directory:
cd opentofu/workload-layer/production - Initialize and apply:
tofu init tofu apply
Post-Bootstrap
Once the tofu apply completes, the Control Center VM will boot, initialize via Cloud-Init, and automatically start pulling this git repository.
From this point on, you no longer need to manually run tofu apply. All future changes to VMs, networks, or applications should be done declaratively via Pull Requests to your repository!