summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorJan Malakhovski <oxij@oxij.org>2018-03-10 14:41:34 +0000
committerJan Malakhovski <oxij@oxij.org>2018-03-10 20:38:13 +0000
commit7079e744d4666db3af186899fe2fc0ef3cbeb842 (patch)
treed65e951be75dab998ecd2e8337e1c30e7722e28c /nixos/modules/tasks
parent4eec6bc9c9cafac55dbf774a2fd30da7e5a79cc4 (diff)
parentddddca5c2fe1c93369404979ac194a1bc5d5fbaf (diff)
downloadnixlib-7079e744d4666db3af186899fe2fc0ef3cbeb842.tar
nixlib-7079e744d4666db3af186899fe2fc0ef3cbeb842.tar.gz
nixlib-7079e744d4666db3af186899fe2fc0ef3cbeb842.tar.bz2
nixlib-7079e744d4666db3af186899fe2fc0ef3cbeb842.tar.lz
nixlib-7079e744d4666db3af186899fe2fc0ef3cbeb842.tar.xz
nixlib-7079e744d4666db3af186899fe2fc0ef3cbeb842.tar.zst
nixlib-7079e744d4666db3af186899fe2fc0ef3cbeb842.zip
Merge branch 'master' into staging
Resolved the following conflicts (by carefully applying patches from the both
branches since the fork point):

   pkgs/development/libraries/epoxy/default.nix
   pkgs/development/libraries/gtk+/3.x.nix
   pkgs/development/python-modules/asgiref/default.nix
   pkgs/development/python-modules/daphne/default.nix
   pkgs/os-specific/linux/systemd/default.nix
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/network-interfaces-scripted.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix
index 8aa5163ce229..630fe6d114ce 100644
--- a/nixos/modules/tasks/network-interfaces-scripted.nix
+++ b/nixos/modules/tasks/network-interfaces-scripted.nix
@@ -288,6 +288,17 @@ let
                 ${i}
               '')}" > /run/${n}.interfaces
 
+              ${optionalString config.virtualisation.libvirtd.enable ''
+                  # Enslave dynamically added interfaces which may be lost on nixos-rebuild
+                  for uri in qemu:///system lxc:///; do
+                    for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do
+                      ${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \
+                      ${pkgs.xmlstarlet}/bin/xmlstarlet sel -t -m "//domain/devices/interface[@type='bridge'][source/@bridge='${n}'][target/@dev]" -v "concat('ip link set ',target/@dev,' master ',source/@bridge,';')" | \
+                      ${pkgs.bash}/bin/bash
+                    done
+                  done
+                ''}
+
               # Enable stp on the interface
               ${optionalString v.rstp ''
                 echo 2 >/sys/class/net/${n}/bridge/stp_state