Files
nixos-servers/docs/plans/completed/bootstrap-cache.md
Torjus Håkestad 732e9b8c22
Some checks failed
Run nix flake check / flake-check (push) Failing after 1s
docs: move bootstrap-cache plan to completed
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 23:41:05 +01:00

1.2 KiB

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.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:

    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