Homelab
A quick guide on setting up new VMs / Servers in the Homelab with proxmox.
Pre-Requisites
- A tailscale setup, with a preauthkey with a long expiry. This will be baked into the nixos ISO for easy access to new VMs
Install Guide
- Generate ISO
This is to be run on the proxmox node.
nix build --refresh "git+https://gitea.ts.yadunut.com/yadunut/homelab.git#generate-iso"
Copy ISO Over to the VM
cp ./result/iso/nixos-yadunut.iso /var/lib/vz/template/iso
- Create virtual machines on proxmox
This command is to be run on the proxmox Node / via SSH. Follow the guide to setup the VM.
TODO: This currently only works on falcon, to support other nodes, I need to create new VMs via the API with pvesh instead of the qm tool.
nix run --refresh --verbose "git+https://gitea.ts.yadunut.com/yadunut/homelab.git.#create-vm"
Copy the IP address
- Use nixos-anywhere to bootstrap virtual machines
nix run ".#bootstrap"`
Process to creating a New Machine
- Create an ISO and transfer it over to Proxmox if it doesn't already exist
- Create the VMs on Proxmox with the
nix run "git+https://gitea.ts.yadunut.com/yadunut/homelab.git#create-vm"command - Create the machine configuration in
./nixos/machines - With NixOS anywhere,
Problem
I want to copy the tailscale key over to the newly initialized VMs. I guess the VMs don't need to have tailscale setup on launch of the ISO unless I bake it into the ISO 🤔
Wait I could bake it into the ISO.
It has been baked into the ISO. So now, I can connect to the VM from without being in the same network :)
Now that I have VMs booted into the ISO, I need to setup the VMs. This would firstly require:
- Generating the host keys
- Tailscale encrypt with age, and transfer to the VM
- Encrypting