nixos/containers: fixup 21e032ff95 (#554983)

This commit is contained in:
Michele Guerini Rocco
2026-08-21 13:54:15 +00:00
committed by GitHub

View File

@@ -526,7 +526,7 @@ let
# Parses an IP address with an optional prefix
ipFromString =
str:
str: defaultPrefix:
let
segments = lib.splitString "/" str;
prefix = lib.elemAt segments 1;
@@ -534,7 +534,7 @@ let
in
{
address = lib.head segments;
prefixLength = if hasPrefix then builtins.fromJSON prefix else 32;
prefixLength = if hasPrefix then builtins.fromJSON prefix else defaultPrefix;
};
in
@@ -610,10 +610,10 @@ in
networking.interfaces = lib.mkIf config.privateNetwork (
lib.mkMerge [
(lib.mkIf (config.localAddress != null) {
eth0.ipv4.addresses = [ (ipFromString config.localAddress) ];
eth0.ipv4.addresses = [ (ipFromString config.localAddress 32) ];
})
(lib.mkIf (config.localAddress6 != null) {
eth0.ipv6.addresses = [ (ipFromString config.localAddress6) ];
eth0.ipv6.addresses = [ (ipFromString config.localAddress6 128) ];
})
]
);