diff options
author | pacien | 2022-11-13 01:50:58 +0100 |
---|---|---|
committer | pacien | 2022-11-13 01:52:14 +0100 |
commit | 42923a5cf2cf6292aaf19eb1b550c6d20bd2a881 (patch) | |
tree | 1ae609e634a39241ce2c87d8e91dbf7a2432f769 | |
parent | dc10af1d930929277505971ce54ec856f91ed7dc (diff) | |
download | flaky-utils-42923a5cf2cf6292aaf19eb1b550c6d20bd2a881.tar.gz |
mkSandboxSystem: inline qemu 9p patch override
-rw-r--r-- | lib/mk-sandbox-system.nix | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/mk-sandbox-system.nix b/lib/mk-sandbox-system.nix index e579183..c24ffa0 100644 --- a/lib/mk-sandbox-system.nix +++ b/lib/mk-sandbox-system.nix | |||
@@ -3,23 +3,10 @@ | |||
3 | , user ? "dummy" | 3 | , user ? "dummy" |
4 | , config ? { } | 4 | , config ? { } |
5 | , restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork | 5 | , restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork |
6 | , patchQemu9p ? false | 6 | , patchQemu9p ? false # until qemu 7.2.0 becomes available in nixpkgs |
7 | }: | 7 | }: |
8 | 8 | ||
9 | let | 9 | rec { |
10 | # Patched QEMU to fix slow 9p file share. | ||
11 | # https://linus.schreibt.jetzt/posts/qemu-9p-performance.html | ||
12 | qemu_kvm_patched_9p = | ||
13 | assert !(pkgs.lib.versionAtLeast pkgs.qemu_kvm.version "7.2.0"); | ||
14 | pkgs.qemu_kvm.overrideAttrs (o: { | ||
15 | patches = o.patches ++ [ (pkgs.fetchpatch { | ||
16 | name = "qemu-9p-performance-fix.patch"; | ||
17 | url = "https://github.com/qemu/qemu/commit/f5265c8.patch"; | ||
18 | sha256 = "sha256-PSOv0dhiEq9g6B1uIbs6vbhGr7BQWCtAoLHnk4vnvVg="; | ||
19 | }) ]; | ||
20 | }); | ||
21 | |||
22 | in rec { | ||
23 | 10 | ||
24 | nixosConfigurations.${name} = pkgs.nixos ({ modulesPath, lib, pkgs, ... }: { | 11 | nixosConfigurations.${name} = pkgs.nixos ({ modulesPath, lib, pkgs, ... }: { |
25 | imports = [ | 12 | imports = [ |
@@ -68,8 +55,21 @@ in rec { | |||
68 | # https://github.com/NixOS/nixpkgs/pull/200225 | 55 | # https://github.com/NixOS/nixpkgs/pull/200225 |
69 | #restrictNetwork = lib.mkDefault true; | 56 | #restrictNetwork = lib.mkDefault true; |
70 | 57 | ||
71 | qemu.package = lib.mkDefault | 58 | # Patched QEMU to fix slow 9p file share. |
72 | (if patchQemu9p then qemu_kvm_patched_9p else pkgs.qemu_kvm); | 59 | # https://linus.schreibt.jetzt/posts/qemu-9p-performance.html |
60 | qemu.package = lib.mkDefault ( | ||
61 | if patchQemu9p then | ||
62 | assert !(pkgs.lib.versionAtLeast pkgs.qemu_kvm.version "7.2.0"); | ||
63 | pkgs.qemu_kvm.overrideAttrs (o: { | ||
64 | patches = o.patches ++ [ (pkgs.fetchpatch { | ||
65 | name = "qemu-9p-performance-fix.patch"; | ||
66 | url = "https://github.com/qemu/qemu/commit/f5265c8.patch"; | ||
67 | sha256 = "sha256-PSOv0dhiEq9g6B1uIbs6vbhGr7BQWCtAoLHnk4vnvVg="; | ||
68 | }) ]; | ||
69 | }) | ||
70 | else pkgs.qemu_kvm | ||
71 | ); | ||
72 | |||
73 | }; | 73 | }; |
74 | }); | 74 | }); |
75 | 75 | ||