From 3ee41979bde302df0fdcd454b205eee1a6ec65f6 Mon Sep 17 00:00:00 2001 From: yukkop Date: Thu, 23 Oct 2025 11:49:34 +0000 Subject: [PATCH] refactor(nixos): `modules`: hetzner network config --- nixos/module/hectic/hardware/hetzner-cloud.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nixos/module/hectic/hardware/hetzner-cloud.nix b/nixos/module/hectic/hardware/hetzner-cloud.nix index ce0bbb3..318d485 100644 --- a/nixos/module/hectic/hardware/hetzner-cloud.nix +++ b/nixos/module/hectic/hardware/hetzner-cloud.nix @@ -51,6 +51,17 @@ in { !! So use IDs ''; }; + networkMatchConfigName = lib.mkOption { + type = lib.types.strMatching "^(enp1s0|ens3)$"; + example = "enp1s0"; + description = '' + type of network conection, + on older hetzner servers may be `ens3` + on newer probably `enp1s0` + + you can use `networkctl list` on server to know it + ''; + }; }; config = lib.mkIf cfg.enable (lib.mkMerge @@ -65,7 +76,7 @@ in { networking.useDHCP = lib.mkDefault true; systemd.network.enable = true; systemd.network.networks."30-wan" = { - matchConfig.Name = "ens3"; + matchConfig.Name = cfg.networkMatchConfigName; networkConfig.DHCP = "no"; address = [ "${cfg.ipv4}/32"