feat(nixos): modules: +network configuration to hetzner hardware

This commit is contained in:
2025-10-22 08:12:17 +00:00
parent e7423780e8
commit 3bfc5799c7

View File

@@ -25,9 +25,23 @@ in {
# then will use "/dev/sda15" (default hetzner cloud boot device) # then will use "/dev/sda15" (default hetzner cloud boot device)
# ''; # '';
#}; #};
ip = lib.mkOption {
type = lib.types.strMatching "^([0-9]{1,3}\\.){3}[0-9]{1,3}$";
example = "188.243.124.246";
description = ''
'';
};
gatewayIp = lib.mkOption {
type = lib.types.strMatching "^([0-9]{1,3}\\.){3}[0-9]{1,3}$";
example = "188.243.124.246";
description = ''
'';
};
device = lib.mkOption { device = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "/dev/sda/"; default = "/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
@@ -48,6 +62,15 @@ in {
] ++ (if pkgs.system != "aarch64-linux" then [ "vmw_pvscsi" ] else []); ] ++ (if pkgs.system != "aarch64-linux" then [ "vmw_pvscsi" ] else []);
boot.initrd.kernelModules = ["nvme"]; boot.initrd.kernelModules = ["nvme"];
networking.useDHCP = false;
networking.interfaces.ens3 = {
ipv4.addresses = [
{ address = cfg.ip; prefixLength = 24; }
];
};
networking.defaultGateway = cfg.gatewayIp;
networking.nameservers = [ "1.1.1.1" "8.8.8.8" ];
disko.devices.disk.vda = { disko.devices.disk.vda = {
device = cfg.device; device = cfg.device;
type = "disk"; type = "disk";