added local DNS

This commit is contained in:
Jakub Kropáček 2025-02-13 11:11:52 +01:00
parent da6c778414
commit f277bd654d
4 changed files with 9 additions and 7 deletions

View file

@ -16,6 +16,7 @@
address = serverIp;
prefixLength = 24;
defaultGateway = "192.168.1.1";
dns = ["192.168.1.250" "1.1.1.1"];
};
};
};

View file

@ -17,6 +17,7 @@
address = serverIp;
prefixLength = 24;
defaultGateway = "192.168.1.1";
dns = ["192.168.1.250" "1.1.1.1"];
};
};
};

View file

@ -17,6 +17,7 @@
address = serverIp;
prefixLength = 24;
defaultGateway = "192.168.1.1";
dns = ["192.168.1.250" "1.1.1.1"];
};
};
};

View file

@ -25,6 +25,11 @@ let
default = null;
example = if version == 4 then "192.168.1.1" else null;
};
dns = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "The DNS servers to use";
default = [ "8.8.8.8" "1.1.1.1" ];
};
};
in
{
@ -103,13 +108,7 @@ in
cfg.ipv4.address == null || cfg.ipv4.prefixLength == null || cfg.ipv4.defaultGateway == null
);
defaultGateway = lib.mkIf (cfg.ipv4.defaultGateway != null) { address = cfg.ipv4.defaultGateway; };
nameservers =
lib.mkIf
(cfg.ipv4.address != null || cfg.ipv4.prefixLength != null || cfg.ipv4.defaultGateway != null)
[
"8.8.8.8"
"1.1.1.1"
];
nameservers = cfg.ipv4.dns;
};
};
}