From 278843e979e7bb123302f7841831f8be82849aff Mon Sep 17 00:00:00 2001 From: jakobrs Date: Sun, 31 Jan 2021 13:40:48 +0100 Subject: [PATCH] nixos/qemu-vm: add virtualisation.msize option --- nixos/modules/virtualisation/qemu-vm.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index bf3615f2fe71..c3a8d1bc3c50 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -275,6 +275,18 @@ in ''; }; + virtualisation.msize = + mkOption { + default = null; + type = types.nullOr types.ints.unsigned; + description = + '' + msize (maximum packet size) option passed to 9p file systems, in + bytes. Increasing this should increase performance significantly, + at the cost of higher RAM usage. + ''; + }; + virtualisation.diskSize = mkOption { default = 512; @@ -663,7 +675,7 @@ in ${if cfg.writableStore then "/nix/.ro-store" else "/nix/store"} = { device = "store"; fsType = "9p"; - options = [ "trans=virtio" "version=9p2000.L" "cache=loose" ]; + options = [ "trans=virtio" "version=9p2000.L" "cache=loose" ] ++ lib.optional (cfg.msize != null) "msize=${toString cfg.msize}"; neededForBoot = true; }; "/tmp" = mkIf config.boot.tmpOnTmpfs @@ -676,13 +688,13 @@ in "/tmp/xchg" = { device = "xchg"; fsType = "9p"; - options = [ "trans=virtio" "version=9p2000.L" ]; + options = [ "trans=virtio" "version=9p2000.L" ] ++ lib.optional (cfg.msize != null) "msize=${toString cfg.msize}"; neededForBoot = true; }; "/tmp/shared" = { device = "shared"; fsType = "9p"; - options = [ "trans=virtio" "version=9p2000.L" ]; + options = [ "trans=virtio" "version=9p2000.L" ] ++ lib.optional (cfg.msize != null) "msize=${toString cfg.msize}"; neededForBoot = true; }; } // optionalAttrs (cfg.writableStore && cfg.writableStoreUseTmpfs)