parent
e4f5ca2fc9
commit
3d8242b314
22 changed files with 340 additions and 211 deletions
2
terraform/incus/.gitignore
vendored
Normal file
2
terraform/incus/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*.tar.xz
|
||||
result
|
||||
10
terraform/incus/images.tf
Normal file
10
terraform/incus/images.tf
Normal 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"
|
||||
}
|
||||
}
|
||||
17
terraform/incus/instances.tf
Normal file
17
terraform/incus/instances.tf
Normal 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
26
terraform/incus/main.tf
Normal 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"
|
||||
}
|
||||
}
|
||||
9
terraform/incus/make-images.fish
Executable file
9
terraform/incus/make-images.fish
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue