mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-26 02:05:02 +00:00
nixos/containers: fixup 21e032ff95
This commit is contained in:
@@ -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) ];
|
||||
})
|
||||
]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user