fix?: hetzner-cloud: newer generation

This commit is contained in:
2026-05-31 11:26:07 +00:00
parent 7d0b335626
commit 6dded5584e
+14 -1
View File
@@ -10,9 +10,21 @@
... ...
}: let }: let
cfg = config.hectic.hardware.hetzner-cloud; cfg = config.hectic.hardware.hetzner-cloud;
isNewer = cfg.generation == "newer";
in { in {
options.hectic.hardware.hetzner-cloud = { options.hectic.hardware.hetzner-cloud = {
enable = lib.mkEnableOption "Enable hetzner-cloud hardware configurations"; enable = lib.mkEnableOption "Enable hetzner-cloud hardware configurations";
generation = lib.mkOption {
type = lib.types.enum [ "classic" "newer" ];
default = "classic";
description = ''
Hetzner server generation profile.
`classic` keeps the historical `/dev/sda` assumption.
`newer` is for ccx/NVMe-era servers and defaults the disk device to
`/dev/nvme0n1`.
'';
};
#bootParUuid = lib.mkOption { #bootParUuid = lib.mkOption {
# type = with lib.types; nullOr oneOf [ # type = with lib.types; nullOr oneOf [
# (lib.types.strMatching "^[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}$") # (lib.types.strMatching "^[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}$")
@@ -41,12 +53,13 @@ in {
}; };
device = lib.mkOption { device = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "/dev/sda"; default = if isNewer then "/dev/nvme0n1" else "/dev/sda";
example = "/dev/disk/by-uuid/f184a16b-6eca-41cb-b48a-ff37cdce1d79"; example = "/dev/disk/by-uuid/f184a16b-6eca-41cb-b48a-ff37cdce1d79";
description = '' description = ''
boot device uuid boot device uuid
if it is null then will use "/dev/sda" if it is null then will use "/dev/sda"
/dev/sda - default hetzner cloud device /dev/sda - default hetzner cloud device
/dev/nvme0n1 - default for newer Hetzner generations
!! But can changes on reboot if server have volumes !! But can changes on reboot if server have volumes
!! So use IDs !! So use IDs
''; '';