From bfa3be010c8c90f1bd0326747b9b424535381bb2 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 12 Nov 2022 03:52:06 +0100 Subject: mkSandboxSystem: add option for qemu 9p perf patch --- lib/mk-sandbox-system.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/mk-sandbox-system.nix b/lib/mk-sandbox-system.nix index bbe0238..7514b93 100644 --- a/lib/mk-sandbox-system.nix +++ b/lib/mk-sandbox-system.nix @@ -4,6 +4,7 @@ , user ? "dummy" , config ? { } , restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork +, patchQemu9p ? false }: with nixpkgs.lib; @@ -11,6 +12,18 @@ with nixpkgs.lib; let pkgs = import nixpkgs { inherit system; }; + # Patched QEMU to fix slow 9p file share. + # https://linus.schreibt.jetzt/posts/qemu-9p-performance.html + qemu_kvm_patched_9p = + assert !(pkgs.lib.versionAtLeast pkgs.qemu_kvm.version "7.2.0"); + pkgs.qemu_kvm.overrideAttrs (o: { + patches = o.patches ++ [ (pkgs.fetchpatch { + name = "qemu-9p-performance-fix.patch"; + url = "https://github.com/qemu/qemu/commit/f5265c8.patch"; + sha256 = "sha256-PSOv0dhiEq9g6B1uIbs6vbhGr7BQWCtAoLHnk4vnvVg="; + }) ]; + }); + in rec { nixosConfigurations.${name} = nixosSystem { @@ -60,6 +73,9 @@ in rec { # Uncomment when this is merged: # https://github.com/NixOS/nixpkgs/pull/200225 #restrictNetwork = mkDefault true; + + qemu.package = mkDefault + (if patchQemu9p then qemu_kvm_patched_9p else pkgs.qemu_kvm); }; }) -- cgit v1.2.3