forked from Fediversity/Fediversity
intended to swap out nixos-anywhere for terraform-nixos, over: - don't need nixos-anywhere to install nixos; we preload nixos to VMs - [awkward non-flake usage](https://nix-community.github.io/nixos-anywhere/howtos/use-without-flakes.html#3-set-nixos-version-to-use) - seemed not to pick up on config changes, as observed by test VMs losing their panel keys after TF sync however, it seems that terraform-nixos has its own flaws: - its output using a random id, i.e. forcing to push even on no changes - so far did not get ssh authentication to work
55 lines
1.1 KiB
HCL
55 lines
1.1 KiB
HCL
variable "terraform-nixos" {
|
|
type = string
|
|
}
|
|
|
|
variable "config" {
|
|
type = string
|
|
}
|
|
|
|
variable "domain" {
|
|
type = string
|
|
}
|
|
|
|
variable "hostname" {
|
|
type = string
|
|
}
|
|
|
|
variable "initialUser" {
|
|
type = object({
|
|
displayName = string
|
|
username = string
|
|
password = string
|
|
email = string
|
|
})
|
|
}
|
|
|
|
module "deploy" {
|
|
source = "${var.terraform-nixos}//deploy_nixos"
|
|
target_host = "${var.hostname}.abundos.eu"
|
|
target_user= "root" # FIXME: #24
|
|
target_system = "x86_64-linux"
|
|
NIX_PATH = "nixpkgs=${data.external.pins.result["nixpkgs"]}:sources=${path.root}/../npins"
|
|
nixos_config = "${path.root}/${var.config}.nix"
|
|
extra_eval_args = [
|
|
"--arg",
|
|
"specialArgs",
|
|
<<-EOT
|
|
{
|
|
sources = import <sources>;
|
|
terraform = builtins.fromJSON ''${jsonencode({
|
|
domain = var.domain
|
|
hostname = var.hostname
|
|
initialUser = var.initialUser
|
|
})}'';
|
|
}
|
|
EOT
|
|
]
|
|
# build_on_target = false
|
|
# triggers = {
|
|
# # pins = data.external.pins.result
|
|
# }
|
|
}
|
|
|
|
data "external" "pins" {
|
|
program = ["nix", "eval", "--json", "-f", "${path.root}/../npins/default.nix"]
|
|
}
|