diff --git a/nix/lib/config/legacy.nix b/nix/lib/config/legacy.nix index 5453c0f..6c2b78a 100644 --- a/nix/lib/config/legacy.nix +++ b/nix/lib/config/legacy.nix @@ -98,6 +98,8 @@ in upstream2.interfaces.up2.upstream.noNat.subnets6 = [ "2a02:8106:208:e900::/56" ]; + upstream3.interfaces.up3.upstream = {}; + upstream4.interfaces.up4.upstream = {}; upstream1.ospf.upstreamInstance = 3; upstream2.ospf.upstreamInstance = 4; anon1.ospf.upstreamInstance = 5; @@ -164,15 +166,14 @@ in interfaces = builtins.mapAttrs (net: interface: renameAttr "gw" "gw4" - (forceVeth interface) // { - upstream = - if ctPillar ? upstream && - ctPillar.upstream.interface == net - then { - upBandwidth = ctPillar.upstream.up-bandwidth; - } - else null; - } + (forceVeth interface) // ( + if ctPillar ? upstream && + ctPillar.upstream.interface == net + then { + upstream.upBandwidth = ctPillar.upstream.up-bandwidth; + } + else {} + ) ) container.interfaces; wireguard = diff --git a/nix/lib/config/options.nix b/nix/lib/config/options.nix index c3667ae..693cb86 100644 --- a/nix/lib/config/options.nix +++ b/nix/lib/config/options.nix @@ -105,6 +105,7 @@ let upstreamOpts = { upBandwidth = mkOption { type = with types; nullOr int; + default = null; }; noNat.subnets6 = mkOption { type = with types; listOf str; diff --git a/nix/nixos-module/container/upstream.nix b/nix/nixos-module/container/upstream.nix index ccf05b7..195e6f3 100644 --- a/nix/nixos-module/container/upstream.nix +++ b/nix/nixos-module/container/upstream.nix @@ -40,7 +40,9 @@ in Parent = root # DOCSIS overhead OverheadBytes = 18 - Bandwidth = ${toString upstream.upBandwidth}K + ${lib.optionalString (upstream.upBandwidth != null) '' + Bandwidth = ${toString upstream.upBandwidth}K + ''} ''; }) upstreamInterfaces;