incus-vm: fix NixOS image lookup using same-remote alias resolution

source_image.remote="local" was resolving against the provisioner machine,
not the target incus host. Use local.incus_remote (same remote as
destination) so the alias nixos/25.11 is looked up on the host that
actually has the image cached.
This commit is contained in:
Ben Potter 2026-04-27 13:06:13 +00:00
parent 5260309f4f
commit a8e04991bf

View File

@ -218,9 +218,11 @@ resource "coder_agent" "main" {
resource "incus_image" "image" {
remote = local.incus_remote
source_image = {
# NixOS images are imported locally (linuxcontainers.org doesn't carry NixOS).
# NixOS images are stored directly on the target incus host (linuxcontainers.org
# doesn't carry NixOS). Use the same remote as the destination so the provider
# resolves the alias locally on that host rather than on the provisioner.
# Ubuntu/other images are pulled from the public images: simplestreams remote.
remote = local.is_nixos ? "local" : "images"
remote = local.is_nixos ? local.incus_remote : "images"
name = local.is_nixos ? data.coder_parameter.image.value : "${data.coder_parameter.image.value}/${data.coder_parameter.host.value == "ThinkStation" ? "amd64" : "arm64"}"
type = "virtual-machine"
architecture = data.coder_parameter.host.value == "ThinkStation" ? "x86_64" : "aarch64"