summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorlethalman <lucabru@src.gnome.org>2015-08-26 10:41:21 +0200
committerlethalman <lucabru@src.gnome.org>2015-08-26 10:41:21 +0200
commit3aed00d593d72ae8f8c45e37d282533bb7d4715a (patch)
tree4c15d344034f599dedf57782fa15071c5625c32e /nixos
parent18bd7ede6595a189885ccf4a41a5cdcbb12d6c4f (diff)
parent77c49d933380126bdc25948807a94ac5b50be577 (diff)
downloadnixpkgs-3aed00d593d72ae8f8c45e37d282533bb7d4715a.tar
nixpkgs-3aed00d593d72ae8f8c45e37d282533bb7d4715a.tar.gz
nixpkgs-3aed00d593d72ae8f8c45e37d282533bb7d4715a.tar.bz2
nixpkgs-3aed00d593d72ae8f8c45e37d282533bb7d4715a.tar.lz
nixpkgs-3aed00d593d72ae8f8c45e37d282533bb7d4715a.tar.xz
nixpkgs-3aed00d593d72ae8f8c45e37d282533bb7d4715a.tar.zst
nixpkgs-3aed00d593d72ae8f8c45e37d282533bb7d4715a.zip
Merge pull request #9395 from bosu/cont-ifaces
containers: add interfaces config option.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/containers.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index da39dda8535..d819d99e09c 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -120,6 +120,15 @@ in
               '';
             };
 
+            interfaces = mkOption {
+              type = types.listOf types.string;
+              default = null;
+              example = [ "eth1" "eth2" ];
+              description = ''
+                The list of interfaces to be moved into the container.
+              '';
+            };
+
             autoStart = mkOption {
               type = types.bool;
               default = false;
@@ -218,6 +227,10 @@ in
               extraFlags+=" --network-veth"
             fi
 
+            for iface in $INTERFACES; do
+              extraFlags+=" --network-interface=$iface"
+            done
+
             for iface in $MACVLANS; do
               extraFlags+=" --network-macvlan=$iface"
             done
@@ -331,6 +344,9 @@ in
                 LOCAL_ADDRESS=${cfg.localAddress}
               ''}
             ''}
+           ${optionalString (cfg.interfaces != null) ''
+             INTERFACES="${toString cfg.interfaces}"
+           ''}
            ${optionalString cfg.autoStart ''
              AUTO_START=1
            ''}