diff options
author | Florian Klink <flokli@flokli.de> | 2019-01-28 12:39:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-28 12:39:13 +0100 |
commit | 38be383a6f5c377c94973177c071077bc42a11c9 (patch) | |
tree | dcb44f210fe1e25ea87bf2a58632be5c263d6d53 /nixos/modules/virtualisation/containers.nix | |
parent | d5670caa4ecaa38ec52b401537f1b7d2d91d2100 (diff) | |
parent | 53013ead39a40e51878a76e24f94a4ae46a9b98a (diff) |
Merge pull request #53419 from uvNikita/containers/fix-bridge
nixos/containers: add bridge without address specified
Diffstat (limited to 'nixos/modules/virtualisation/containers.nix')
-rw-r--r-- | nixos/modules/virtualisation/containers.nix | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix index c2e6e9f6a136..7c9909ae2787 100644 --- a/nixos/modules/virtualisation/containers.nix +++ b/nixos/modules/virtualisation/containers.nix @@ -36,7 +36,7 @@ let #! ${pkgs.runtimeShell} -e # Initialise the container side of the veth pair. - if [ -n "$HOST_ADDRESS" ] || [ -n "$LOCAL_ADDRESS" ]; then + if [ -n "$HOST_ADDRESS" ] || [ -n "$LOCAL_ADDRESS" ] || [ -n "$HOST_BRIDGE" ]; then ip link set host0 name eth0 ip link set dev eth0 up @@ -90,18 +90,20 @@ let if [ -n "$HOST_ADDRESS" ] || [ -n "$LOCAL_ADDRESS" ]; then extraFlags+=" --network-veth" - if [ -n "$HOST_BRIDGE" ]; then - extraFlags+=" --network-bridge=$HOST_BRIDGE" - fi - if [ -n "$HOST_PORT" ]; then - OIFS=$IFS - IFS="," - for i in $HOST_PORT - do - extraFlags+=" --port=$i" - done - IFS=$OIFS - fi + fi + + if [ -n "$HOST_PORT" ]; then + OIFS=$IFS + IFS="," + for i in $HOST_PORT + do + extraFlags+=" --port=$i" + done + IFS=$OIFS + fi + + if [ -n "$HOST_BRIDGE" ]; then + extraFlags+=" --network-bridge=$HOST_BRIDGE" fi extraFlags+=" ${concatStringsSep " " (mapAttrsToList nspawnExtraVethArgs cfg.extraVeths)}" |