wip on probe (hetzner cloud machine)
This commit is contained in:
parent
7b947200f6
commit
c2e75689a0
10 changed files with 191 additions and 1 deletions
|
@ -14,7 +14,7 @@
|
|||
|
||||
# some system stuff
|
||||
# -----------------
|
||||
time.timeZone = lib.mkDefault "Europe/Berlin";
|
||||
time.timeZone = "Europe/Berlin";
|
||||
#time.timeZone = lib.mkDefault "Pacific/Auckland";
|
||||
#time.timeZone = lib.mkDefault "Asia/Singapore";
|
||||
#time.timeZone = lib.mkDefault "Asia/Makassar";
|
||||
|
|
25
flake.nix
25
flake.nix
|
@ -437,6 +437,31 @@
|
|||
];
|
||||
};
|
||||
|
||||
|
||||
probe = clanSetup {
|
||||
name = "probe";
|
||||
host = "probe.bear";
|
||||
modules = [
|
||||
homeManagerModules
|
||||
stylixModules
|
||||
srvos.nixosModules.hardware-hetzner-cloud
|
||||
srvos.nixosModules.server
|
||||
srvos.nixosModules.mixins-terminfo
|
||||
{
|
||||
# not needed for servers in general
|
||||
boot.initrd.systemd.emergencyAccess = false;
|
||||
systemd.enableEmergencyMode = false;
|
||||
}
|
||||
{
|
||||
home-manager.users.mainUser = import ./homes/palo;
|
||||
home-manager.users.root = import ./homes/root;
|
||||
}
|
||||
{
|
||||
clan.core.machineDescription = "Dummy Internet Server";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
13
machines/probe/configuration.nix
Normal file
13
machines/probe/configuration.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ lib, config, pkgs, ... }: {
|
||||
imports = [
|
||||
./hardware-configuration
|
||||
../../components
|
||||
../../modules
|
||||
];
|
||||
|
||||
components.mainUser.enable = true;
|
||||
|
||||
networking.hostName = "probe";
|
||||
users.users.root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJkqVvuJSvRMO5pG2CHNNBxjB7HlJudK4TQs3BhbOWOD" ];
|
||||
|
||||
}
|
15
machines/probe/hardware-configuration/default.nix
Normal file
15
machines/probe/hardware-configuration/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, factsGenerator, clanLib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./disko-config.nix
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
boot.tmp.useTmpfs = true; # make /tmp a tmpfs (performance!)
|
||||
|
||||
boot.loader.grub = {
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
};
|
||||
|
||||
}
|
39
machines/probe/hardware-configuration/disko-config.nix
Normal file
39
machines/probe/hardware-configuration/disko-config.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Example to create a bios compatible gpt partition
|
||||
{ lib, ... }:
|
||||
{
|
||||
disko.devices = {
|
||||
disk.disk1 = {
|
||||
device = lib.mkDefault "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.tinc.private.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
powerManagement.cpuFreqGovernor = "powersave";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
1
terraform/hetzner/.gitignore
vendored
Normal file
1
terraform/hetzner/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
terraform.tfstate*
|
18
terraform/hetzner/_generated_provider.tf
Normal file
18
terraform/hetzner/_generated_provider.tf
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
|
||||
terraform {
|
||||
required_providers {
|
||||
hcloud = {
|
||||
source = "hetznercloud/hcloud"
|
||||
version = "1.44.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "hcloud_token" {
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
# Configure the Hetzner Cloud Provider
|
||||
provider "hcloud" {
|
||||
token = var.hcloud_token
|
||||
}
|
23
terraform/hetzner/main.tf
Normal file
23
terraform/hetzner/main.tf
Normal file
|
@ -0,0 +1,23 @@
|
|||
resource "hcloud_ssh_key" "palo" {
|
||||
name = "palo"
|
||||
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw=="
|
||||
}
|
||||
|
||||
resource "hcloud_server" "probe" {
|
||||
name = "probe"
|
||||
image = "debian-11"
|
||||
server_type = "cx22"
|
||||
ssh_keys = [hcloud_ssh_key.palo.id]
|
||||
public_net {
|
||||
ipv4_enabled = true
|
||||
ipv6_enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
output "ipv4" {
|
||||
value = hcloud_server.probe.ipv4_address
|
||||
}
|
||||
|
||||
output "ipv6" {
|
||||
value = hcloud_server.probe.ipv6_address
|
||||
}
|
27
terraform/hetzner/terragrunt.hcl
Normal file
27
terraform/hetzner/terragrunt.hcl
Normal file
|
@ -0,0 +1,27 @@
|
|||
generate "provider" {
|
||||
path = "_generated_provider.tf"
|
||||
if_exists = "overwrite_terragrunt"
|
||||
contents = <<EOF
|
||||
terraform {
|
||||
required_providers {
|
||||
hcloud = {
|
||||
source = "hetznercloud/hcloud"
|
||||
version = "1.44.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "hcloud_token" {
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
# Configure the Hetzner Cloud Provider
|
||||
provider "hcloud" {
|
||||
token = var.hcloud_token
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
inputs = {
|
||||
hcloud_token = run_cmd("--terragrunt-quiet", "pass", "development/hetzner.com/api-token")
|
||||
}
|
Loading…
Reference in a new issue