summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathijs Kwik <mathijs@bluescreen303.nl>2014-12-18 15:39:03 +0100
committerMathijs Kwik <mathijs@bluescreen303.nl>2014-12-19 08:52:06 +0100
commit6cdacdd4a2164047efe89c6a87f689fefefee85f (patch)
treebe328efc8f87a9be64565098bfa72d35ac8b6cb5
parenta8c726da560f0ae81e08b96c9770cd43860870ee (diff)
downloadnixlib-6cdacdd4a2164047efe89c6a87f689fefefee85f.tar
nixlib-6cdacdd4a2164047efe89c6a87f689fefefee85f.tar.gz
nixlib-6cdacdd4a2164047efe89c6a87f689fefefee85f.tar.bz2
nixlib-6cdacdd4a2164047efe89c6a87f689fefefee85f.tar.lz
nixlib-6cdacdd4a2164047efe89c6a87f689fefefee85f.tar.xz
nixlib-6cdacdd4a2164047efe89c6a87f689fefefee85f.tar.zst
nixlib-6cdacdd4a2164047efe89c6a87f689fefefee85f.zip
nixos/qemu-vm: make networking options configurable
-rw-r--r--nixos/modules/virtualisation/qemu-vm.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index a7610b3e11a0..49376bab41e6 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -57,8 +57,7 @@ let
           -name ${vmName} \
           -m ${toString config.virtualisation.memorySize} \
           ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \
-          -net nic,vlan=0,model=virtio \
-          -net user,vlan=0''${QEMU_NET_OPTS:+,$QEMU_NET_OPTS} \
+          ${concatStringsSep " " config.virtualisation.qemuNetworkingOptions} \
           -virtfs local,path=/nix/store,security_model=none,mount_tag=store \
           -virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \
           -virtfs local,path=''${SHARED_DIR:-$TMPDIR/xchg},security_model=none,mount_tag=shared \
@@ -180,6 +179,23 @@ in
           '';
       };
 
+    virtualisation.qemuNetworkingOptions =
+      mkOption {
+        default = [
+          "-net nic,vlan=0,model=virtio"
+          "-net user,vlan=0\${QEMU_NET_OPTS:+,$QEMU_NET_OPTS}"
+        ];
+        type = types.listOf types.str;
+        description = ''
+          Networking-related command-line options that should be passed to qemu.
+          The default is to use userspace networking (slirp).
+
+          If you override this option, be adviced to keep
+          ''${QEMU_NET_OPTS:+,$QEMU_NET_OPTS} (as seen in the default)
+          to keep the default runtime behaviour.
+        '';
+      };
+
     virtualisation.graphics =
       mkOption {
         default = true;