Commit 684ffbef9da0

Vincent Demeester <vincent@sbr.pm>
2019-06-14 15:54:15
profiles.virtualization: enable nested virt
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent d0e61a8
Changed files (4)
machine/honshu.nix
@@ -27,6 +27,7 @@ options edns0
     syncthing.enable = true;
     virtualization = {
       enable = true;
+      nested = true;
       listenTCP = true;
     };
   };
machine/okinawa.nix
@@ -20,6 +20,7 @@ with import ../assets/machines.nix; {
     syncthing.enable = true;
     virtualization = {
       enable = true;
+      nested = true;
       listenTCP = true;
     };
   };
machine/wakasu.nix
@@ -58,6 +58,7 @@ options edns0
     };
     virtualization = {
       enable = true;
+      nested = true;
       listenTCP = true;
     };
   };
modules/profiles/virtualization.nix
@@ -12,6 +12,11 @@ in
         description = "Enable virtualization profile";
         type = types.bool;
       };
+      nested = mkOption {
+        default = false;
+        description = "Enable nested virtualization";
+        type = types.bool;
+      };
       listenTCP = mkOption {
         default = false;
         description = "Make libvirt listen to TCP";
@@ -29,6 +34,11 @@ in
         vde2
       ];
     }
+    (mkIf cfg.nested {
+      environment.etc."modprobe.d/kvm.conf".text = ''
+options kvm_intel nested=1
+      '';
+    })
     (mkIf config.profiles.desktop.enable {
       environment.systemPackages = with pkgs; [ virtmanager ];
     })