diff options
-rw-r--r-- | lib/mk-sandbox-system.nix | 16 |
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 | ||
9 | with nixpkgs.lib; | 10 | with nixpkgs.lib; |
@@ -11,6 +12,18 @@ with nixpkgs.lib; | |||
11 | let | 12 | let |
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 | |||
14 | in rec { | 27 | in 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 | ||