nixos/networkd: only set gateway if it's explicitly specified in the module system

This commit is contained in:
Maximilian Bosch 2019-12-08 02:27:25 +01:00
parent 5368791937
commit ff65638bfc
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -60,8 +60,8 @@ in
let
domains = cfg.search ++ (optional (cfg.domain != null) cfg.domain);
genericNetwork = override:
let gateway = optional (cfg.defaultGateway != null) cfg.defaultGateway.address
++ optional (cfg.defaultGateway6 != null) cfg.defaultGateway6.address;
let gateway = optional (cfg.defaultGateway != null && (cfg.defaultGateway.address or "") != "") cfg.defaultGateway.address
++ optional (cfg.defaultGateway6 != null && (cfg.defaultGateway6.address or "") != "") cfg.defaultGateway6.address;
in optionalAttrs (gateway != [ ]) {
routes = override [
{