diff --git a/components/default.nix b/components/default.nix index 66bc65d..41cb29f 100644 --- a/components/default.nix +++ b/components/default.nix @@ -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"; diff --git a/flake.nix b/flake.nix index eaeaa62..eb056fd 100644 --- a/flake.nix +++ b/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"; + } + ]; + }; + }; }; diff --git a/machines/probe/configuration.nix b/machines/probe/configuration.nix new file mode 100644 index 0000000..1f9f443 --- /dev/null +++ b/machines/probe/configuration.nix @@ -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" ]; + +} diff --git a/machines/probe/hardware-configuration/default.nix b/machines/probe/hardware-configuration/default.nix new file mode 100644 index 0000000..18367ab --- /dev/null +++ b/machines/probe/hardware-configuration/default.nix @@ -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; + }; + +} diff --git a/machines/probe/hardware-configuration/disko-config.nix b/machines/probe/hardware-configuration/disko-config.nix new file mode 100644 index 0000000..b2271dd --- /dev/null +++ b/machines/probe/hardware-configuration/disko-config.nix @@ -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 = "/"; + }; + }; + }; + }; + }; + }; +} diff --git a/machines/probe/hardware-configuration/hardware-configuration.nix b/machines/probe/hardware-configuration/hardware-configuration.nix new file mode 100644 index 0000000..9e5d555 --- /dev/null +++ b/machines/probe/hardware-configuration/hardware-configuration.nix @@ -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..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; +} diff --git a/terraform/hetzner/.gitignore b/terraform/hetzner/.gitignore new file mode 100644 index 0000000..906b2dc --- /dev/null +++ b/terraform/hetzner/.gitignore @@ -0,0 +1 @@ +terraform.tfstate* \ No newline at end of file diff --git a/terraform/hetzner/_generated_provider.tf b/terraform/hetzner/_generated_provider.tf new file mode 100644 index 0000000..db19115 --- /dev/null +++ b/terraform/hetzner/_generated_provider.tf @@ -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 +} diff --git a/terraform/hetzner/main.tf b/terraform/hetzner/main.tf new file mode 100644 index 0000000..26d6acb --- /dev/null +++ b/terraform/hetzner/main.tf @@ -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 +} diff --git a/terraform/hetzner/terragrunt.hcl b/terraform/hetzner/terragrunt.hcl new file mode 100644 index 0000000..894c77b --- /dev/null +++ b/terraform/hetzner/terragrunt.hcl @@ -0,0 +1,27 @@ +generate "provider" { + path = "_generated_provider.tf" + if_exists = "overwrite_terragrunt" + contents = <