aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2022-11-12 03:52:06 +0100
committerpacien2022-11-12 03:52:06 +0100
commitbfa3be010c8c90f1bd0326747b9b424535381bb2 (patch)
tree0ac7287c5ebafa642adefd58af6e0c61d3e3d51d
parent82562b316b38ca08bd0187fe5a1c3a343219b6f1 (diff)
downloadflaky-utils-bfa3be010c8c90f1bd0326747b9b424535381bb2.tar.gz
mkSandboxSystem: add option for qemu 9p perf patch
-rw-r--r--lib/mk-sandbox-system.nix16
1 files changed, 16 insertions, 0 deletions
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 @@
4, user ? "dummy" 4, user ? "dummy"
5, config ? { } 5, config ? { }
6, restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork 6, restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork
7, patchQemu9p ? false
7}: 8}:
8 9
9with nixpkgs.lib; 10with nixpkgs.lib;
@@ -11,6 +12,18 @@ with nixpkgs.lib;
11let 12let
12 pkgs = import nixpkgs { inherit system; }; 13 pkgs = import nixpkgs { inherit system; };
13 14
15 # Patched QEMU to fix slow 9p file share.
16 # https://linus.schreibt.jetzt/posts/qemu-9p-performance.html
17 qemu_kvm_patched_9p =
18 assert !(pkgs.lib.versionAtLeast pkgs.qemu_kvm.version "7.2.0");
19 pkgs.qemu_kvm.overrideAttrs (o: {
20 patches = o.patches ++ [ (pkgs.fetchpatch {
21 name = "qemu-9p-performance-fix.patch";
22 url = "https://github.com/qemu/qemu/commit/f5265c8.patch";
23 sha256 = "sha256-PSOv0dhiEq9g6B1uIbs6vbhGr7BQWCtAoLHnk4vnvVg=";
24 }) ];
25 });
26
14in rec { 27in rec {
15 28
16 nixosConfigurations.${name} = nixosSystem { 29 nixosConfigurations.${name} = nixosSystem {
@@ -60,6 +73,9 @@ in rec {
60 # Uncomment when this is merged: 73 # Uncomment when this is merged:
61 # https://github.com/NixOS/nixpkgs/pull/200225 74 # https://github.com/NixOS/nixpkgs/pull/200225
62 #restrictNetwork = mkDefault true; 75 #restrictNetwork = mkDefault true;
76
77 qemu.package = mkDefault
78 (if patchQemu9p then qemu_kvm_patched_9p else pkgs.qemu_kvm);
63 }; 79 };
64 }) 80 })
65 81