opentofu incus
Some checks are pending
/ check (push) Waiting to run

This commit is contained in:
iofq 2026-03-21 13:41:50 -05:00
parent e4f5ca2fc9
commit f022e338b0
22 changed files with 353 additions and 214 deletions

2
terraform/incus/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.tar.xz
result

10
terraform/incus/images.tf Normal file
View file

@ -0,0 +1,10 @@
resource "incus_image" "nixos-lxc-base" {
source_file = {
data_path = "lxc.tar.xz"
metadata_path = "lxc-metadata.tar.xz"
}
alias {
name = "nixos-lxc-base"
description = "Nixos Base"
}
}

View file

@ -0,0 +1,17 @@
resource "incus_instance" "zen" {
name = "zen"
image = incus_image.nixos-lxc-base.fingerprint
config = {
"boot.autostart" = true
"limits.cpu" = 2
}
device {
name = "zfs"
type = "unix-block"
properties = {
source = "/dev/disk/by-id/wwn-0x50014ee2671b7f30"
}
}
}

26
terraform/incus/main.tf Normal file
View file

@ -0,0 +1,26 @@
terraform {
required_providers {
incus = {
source = "lxc/incus"
}
}
}
provider "incus" {
generate_client_certificates = true
accept_remote_certificate = true
default_remote = "incus"
remote {
name = "incus"
address = "https://incus:8443"
}
}
resource "incus_network" "enp4s0" {
name = "enp4s0"
type = "physical"
config = {
parent = "enp4s0"
}
}

View file

@ -0,0 +1,9 @@
#!/usr/bin/env fish
function make-image -a variant
nixos-rebuild build-image --flake .#base --image-variant $variant
and cp ./result/tarball/*.tar.xz $variant.tar.xz
end
make-image lxc
make-image lxc-metadata