From 9dfb0980adcf03278fb71fda8eda4ca1fa23cb6a Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 2 Oct 2024 13:07:10 +0800 Subject: [PATCH] nixos/profiles/hetzner-cloud-cx22: init It's mostly generic at this point and I want to manage more of them. --- configs/nixos/plover/default.nix | 6 +---- modules/nixos/profiles/hetzner-cloud-cx22.nix | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 modules/nixos/profiles/hetzner-cloud-cx22.nix diff --git a/configs/nixos/plover/default.nix b/configs/nixos/plover/default.nix index ac10661a..c23e82f8 100644 --- a/configs/nixos/plover/default.nix +++ b/configs/nixos/plover/default.nix @@ -2,16 +2,12 @@ { imports = [ - # Since this will be rarely configured, make sure to import the appropriate - # hardware modules depending on the hosting provider (and even just the - # server). - ./modules/profiles/hetzner-cloud-cx22.nix - # The users for this host. (foodogsquaredUtils.getUser "nixos" "admin") (foodogsquaredUtils.getUser "nixos" "plover") "${foodogsquaredModulesPath}/profiles/hardened.nix" + "${foodogsquaredModulesPath}/profiles/hetzner-cloud-cx22.nix" ./disko.nix diff --git a/modules/nixos/profiles/hetzner-cloud-cx22.nix b/modules/nixos/profiles/hetzner-cloud-cx22.nix new file mode 100644 index 00000000..c96eb7fa --- /dev/null +++ b/modules/nixos/profiles/hetzner-cloud-cx22.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + # Hetzner can only support non-UEFI bootloader (or at least it doesn't with + # systemd-boot). + boot.loader.grub = { + enable = lib.mkForce true; + efiSupport = true; + efiInstallAsRemovable = true; + }; + + boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ "nvme" ]; + + zramSwap.enable = true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + services.qemuGuest.enable = true; + systemd.services.qemu-guest-agent.path = [ pkgs.shadow ]; +}