terraformize the repo

This commit is contained in:
TheWanderingCrow 2025-02-07 11:57:56 -05:00
parent aade69f2a6
commit 0186ffd7ad
6 changed files with 203 additions and 1 deletions

18
.gitignore vendored
View file

@ -1,2 +1,20 @@
# Nix
result result
*.qcow2 *.qcow2
# Terraform
config.tf.json
.terraform/*
*.tfstate
*.tfstate.*
crash.log
crash.*.log
*.tfvars
*.tfvars.json
override.tf
override.tf.json
*_override.tf
*_override.tf.json
.terraform.tfstate.lock.info
.terraformrc
terraform.rc

26
.terraform.lock.hcl generated Normal file
View file

@ -0,0 +1,26 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/digitalocean/digitalocean" {
version = "2.48.2"
constraints = "2.48.2"
hashes = [
"h1:y7q0SCCnYga9rvhSmp5fMH+nxrQHBXEbzqmgeNq+lo8=",
"zh:09299913d836a4b03176ffe33661b93962ea55e352e073f964623196ea6e28ec",
"zh:09fc8c2ddfe81549dff5e9becad75601b6e3bcfaaf8c8717adb808e8b1a2e43e",
"zh:46e799ef82c5239170c4013aacf06c320e5ac9ddd37c83353c7e9a743750efc6",
"zh:5ecb6388a96f4e5e049afb0c2b46fd7ca6aabab33f5c91eebdfd9420b631080c",
"zh:602ef48a3bd4405e708d0acc37daed1977ec3f4808b79ab550098ca7d1fd0b1d",
"zh:616ec732598cb2775dba6a525636563cc3cd389b8273b7eea8e818c55a56b949",
"zh:6b35e3a493b9d3e744dc63a47b2d91e9a5a804448d1122d84c7a68f966d01a89",
"zh:70b339c806dc5f18354a9062c90b34b9e246a91d24c6fabb03d1deae1d1c2466",
"zh:8bc1e95c05c1088b6058b38d624031a5993f8e6aacd746572d42f87901b722ec",
"zh:a138c45dde46c7ae9587a7b3043ab2502502be882f88eaa6bdcff12c9762e4ac",
"zh:a978ed11324729f551781360cbe253730872461ff4a89becd3ec9331e00c2f7d",
"zh:bf80ba60b1f14c5c7d241e4dd0f2c1e6485f17f107a4dd21f09afdf7d9489b7d",
"zh:d219b3de335dd988f4d76daebc9dfe2f0825fbb6721fd075a858b32e073ec726",
"zh:d8894873d654ef534a58be5c35702f57d93faac12ca736ee56b80942bcc7114b",
"zh:e05e8ea72e41c5f019a23bfe8b9e66da3dd50f6ba7344b4225ba99fb852e89a0",
"zh:e4441b27c8e96ac8b791ae93b6fa002bdd941f1a4ff6210b322f3bddb754976b",
]
}

132
flake.lock generated
View file

@ -1,5 +1,37 @@
{ {
"nodes": { "nodes": {
"bats-assert": {
"flake": false,
"locked": {
"lastModified": 1692829535,
"narHash": "sha256-oDqhUQ6Xg7a3xx537SWLGRzqP3oKKeyY4UYGCdz9z/Y=",
"owner": "bats-core",
"repo": "bats-assert",
"rev": "e2d855bc78619ee15b0c702b5c30fb074101159f",
"type": "github"
},
"original": {
"owner": "bats-core",
"repo": "bats-assert",
"type": "github"
}
},
"bats-support": {
"flake": false,
"locked": {
"lastModified": 1693050811,
"narHash": "sha256-PxJaH16+QrsfZqtkWVt5K6TwJB5gjIXnbGo+MB84WIU=",
"owner": "bats-core",
"repo": "bats-support",
"rev": "9bf10e876dd6b624fe44423f0b35e064225f7556",
"type": "github"
},
"original": {
"owner": "bats-core",
"repo": "bats-support",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
@ -18,6 +50,23 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1727826117,
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -142,6 +191,18 @@
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
} }
}, },
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1727825735,
"narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1738142207, "lastModified": 1738142207,
@ -190,6 +251,21 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": {
"locked": {
"lastModified": 1728956102,
"narHash": "sha256-J8zo+UYNjHATsxn2/ROl8iaji2RgLm+sG7b3VcD36YM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3d85bae2431f20ab1ac5cf14d03d314dffe629af",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": { "nmd": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -3079,7 +3155,8 @@
"nix-secrets": "nix-secrets", "nix-secrets": "nix-secrets",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nvix": "nvix", "nvix": "nvix",
"sops-nix": "sops-nix" "sops-nix": "sops-nix",
"terranix": "terranix"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -3152,6 +3229,59 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"terranix": {
"inputs": {
"bats-assert": "bats-assert",
"bats-support": "bats-support",
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_5",
"systems": "systems_3",
"terranix-examples": "terranix-examples"
},
"locked": {
"lastModified": 1736894800,
"narHash": "sha256-Wt3MohH6lx3dQnpYdkq1r3kopWaKVCiKesAzI10Jek0=",
"owner": "terranix",
"repo": "terranix",
"rev": "cd369149ebe821ed81f58410f889e369820eb1a4",
"type": "github"
},
"original": {
"owner": "terranix",
"repo": "terranix",
"type": "github"
}
},
"terranix-examples": {
"locked": {
"lastModified": 1637156952,
"narHash": "sha256-KqvXIe1yiKOEP9BRYqNQN+LOWPCsWojh0WjEgv5jfEI=",
"owner": "terranix",
"repo": "terranix-examples",
"rev": "921680efb8af0f332d8ad73718d53907f9483e24",
"type": "github"
},
"original": {
"owner": "terranix",
"repo": "terranix-examples",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -8,12 +8,14 @@
nvix.url = "github:TheWanderingCrow/nvix"; nvix.url = "github:TheWanderingCrow/nvix";
sops-nix.url = "github:Mic92/sops-nix"; sops-nix.url = "github:Mic92/sops-nix";
nix-secrets.url = "git+ssh://git@github.com/TheWanderingCrow/nix-secrets"; nix-secrets.url = "git+ssh://git@github.com/TheWanderingCrow/nix-secrets";
terranix.url = "github:terranix/terranix";
}; };
outputs = { outputs = {
nixpkgs, nixpkgs,
home-manager, home-manager,
sops-nix, sops-nix,
terranix,
... ...
} @ inputs: let } @ inputs: let
baseModules = [ baseModules = [
@ -111,5 +113,14 @@
++ baseModules; ++ baseModules;
}; };
}; };
############
# Terranix #
############
terranix = {
wce = terranix.lib.terranixConfiguration {
system = "x86_64-linux";
modules = [./infrastructure/wce.nix];
};
};
}; };
} }

16
infrastructure/wce.nix Normal file
View file

@ -0,0 +1,16 @@
{...}: {
terraform.required_providers = {
digitalocean = {
source = "digitalocean/digitalocean";
version = "2.48.2";
};
};
resource."digitalocean_droplet"."do-wce-lighthouse1" = {
image = "177939596"; # nixos-digitalocean
name = "do-wce-lighthouse1";
region = "nyc3";
size = "s-1vcpu-1gb";
ssh_keys = ["45378200"];
};
}

View file

@ -7,6 +7,7 @@
nix nix
alejandra alejandra
nixos-generators nixos-generators
terraform
]; ];
}; };
} }