From 39e06391f1d5faf667015c0a90570a6e4e9afa15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 26 Nov 2021 10:29:21 +0100 Subject: [PATCH] make addresses optional --- modules/retiolum/default.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/retiolum/default.nix b/modules/retiolum/default.nix index 83caf6c..4937150 100644 --- a/modules/retiolum/default.nix +++ b/modules/retiolum/default.nix @@ -9,7 +9,8 @@ let in { options = { networking.retiolum.ipv4 = mkOption { - type = types.str; + type = types.nullOr types.str; + default = null; description = '' own ipv4 address ''; @@ -84,6 +85,10 @@ in { networking.firewall.allowedTCPPorts = [ 655 ]; networking.firewall.allowedUDPPorts = [ 655 ]; + warnings = lib.optional (cfg.ipv6 == null) '' + `networking.retiolum.ipv6` is not set + ''; + systemd.network.enable = true; systemd.network.networks."${netname}".extraConfig = '' [Match] @@ -94,8 +99,8 @@ in { MTUBytes=1377 [Network] - Address=${cfg.ipv4}/12 - Address=${cfg.ipv6}/16 + ${optionalString (cfg.ipv4 != null) "Address=${cfg.ipv4}/12"} + ${optionalString (cfg.ipv6 != null) "Address=${cfg.ipv6}/12"} ''; }; }