make addresses optional

This commit is contained in:
Jörg Thalheim 2021-11-26 10:29:21 +01:00
parent e318a277fd
commit 39e06391f1
1 changed files with 8 additions and 3 deletions

View File

@ -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"}
'';
};
}