From 38c104ea8ce4a8d2505fb3cfcc6ecb710b80d67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sat, 7 Feb 2026 20:06:55 +0100 Subject: [PATCH] docs: add plan for configuring template2 with nix cache Bootstrap times can be improved by configuring the base template to use the local nix cache during initial builds. Co-Authored-By: Claude Opus 4.5 --- docs/plans/bootstrap-cache.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 docs/plans/bootstrap-cache.md diff --git a/docs/plans/bootstrap-cache.md b/docs/plans/bootstrap-cache.md new file mode 100644 index 0000000..2fec399 --- /dev/null +++ b/docs/plans/bootstrap-cache.md @@ -0,0 +1,35 @@ +# Plan: Configure Template2 to Use Nix Cache + +## Problem + +New VMs bootstrapped from template2 don't use our local nix cache (nix-cache.home.2rjus.net) during the initial `nixos-rebuild boot`. This means the first build downloads everything from cache.nixos.org, which is slower and uses more bandwidth. + +## Solution + +Update the template2 base image to include the nix cache configuration, so new VMs immediately benefit from cached builds during bootstrap. + +## Implementation + +1. Add nix cache configuration to `hosts/template2/configuration.nix`: + ```nix + nix.settings = { + substituters = [ "https://nix-cache.home.2rjus.net" "https://cache.nixos.org" ]; + trusted-public-keys = [ + "nix-cache.home.2rjus.net:..." # Add the cache's public key + "cache.nixos.org-1:..." + ]; + }; + ``` + +2. Rebuild and redeploy the Proxmox template: + ```bash + nix develop -c ansible-playbook -i playbooks/inventory.ini playbooks/build-and-deploy-template.yml + ``` + +3. Update `default_template_name` in `terraform/variables.tf` if the template name changed + +## Benefits + +- Faster VM bootstrap times +- Reduced bandwidth to external cache +- Most derivations will already be cached from other hosts