feat: it boots

This commit is contained in:
Tine 2024-08-21 23:00:23 +02:00
parent 274fd90d2c
commit 797416e0fc
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
4 changed files with 35 additions and 11 deletions

View file

@ -7,6 +7,33 @@
} : {
system.stateVersion = "23.11";
#boot.loader.systemd-boot.enable = true;
#boot.loader.efi.canTouchEfiVariables = true;
# PROXMOX
services.qemuGuest.enable = true;
# USER MANAGEMENT
nix.settings.trusted-users = [ "nixos" ];
users.users.nixos =
{
isNormalUser = true;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICXAlzwziqfUUb2qmFwNF/nrBYc5MNT1MMOx81ohBmB+ tine@little.sys.tjo.space"
];
};
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "no";
};
security.sudo.wheelNeedsPassword = false;
# NGINX
services.nginx.enable = true;
environment.systemPackages = [
pkgs.nginx
];

View file

@ -28,12 +28,11 @@
{
packages = forAllVMs ({ system, pkgs }: {
vm = nixos-generators.nixosGenerate {
format = "proxmox";
format = "qcow-efi";
system = system;
specialArgs = {
pkgs = pkgs;
#diskSize = "8G";
};
modules = [

View file

@ -18,7 +18,7 @@ build:
deploy:
#!/usr/bin/env sh
export NIX_RESULT_DIR=$(nix build --print-out-paths .#vm)
export IMAGE_NAME=$(ls ${NIX_RESULT_DIR} | grep ".vma.zst")
export IMAGE_NAME=$(ls ${NIX_RESULT_DIR} | grep ".qcow2")
export TF_VAR_image_path=${NIX_RESULT_DIR}/${IMAGE_NAME}
cd {{justfile_directory()}}/terraform

View file

@ -2,6 +2,7 @@ locals {
nodes_with_names = {
for k, v in var.nodes : k => merge(v, {
id = 700 + index(keys(var.nodes), k)
name = "${v.name}.ingress.tjo.cloud"
hash = sha1(v.name)
})
}
@ -11,7 +12,6 @@ locals {
})
}
ipv4_addresses = {
for key, node in local.nodes : key => {
for k, v in proxmox_virtual_environment_vm.nodes[key].ipv4_addresses :
@ -56,7 +56,7 @@ resource "proxmox_virtual_environment_file" "cloudinit" {
data = <<-EOF
EOF
file_name = "${each.value.name}-ingress-tjo-cloud.cloudinit.yaml"
file_name = "${each.value.name}.cloudinit.yaml"
}
}
@ -88,6 +88,8 @@ resource "proxmox_virtual_environment_vm" "nodes" {
dedicated = each.value.memory
}
bios = "ovmf"
operating_system {
type = "l26"
}
@ -102,14 +104,10 @@ resource "proxmox_virtual_environment_vm" "nodes" {
mac_address = each.value.mac_address
}
cdrom {
enabled = true
file_id = proxmox_virtual_environment_file.ingress.id
}
scsi_hardware = "virtio-scsi-single"
disk {
file_format = "raw"
file_id = proxmox_virtual_environment_file.ingress.id
file_format = "qcow2"
interface = "virtio0"
datastore_id = each.value.storage
size = each.value.boot_size