From 42923a5cf2cf6292aaf19eb1b550c6d20bd2a881 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 13 Nov 2022 01:50:58 +0100 Subject: mkSandboxSystem: inline qemu 9p patch override --- lib/mk-sandbox-system.nix | 34 +++++++++++++++++----------------- 1 file 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 @@ , user ? "dummy" , config ? { } , restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork -, patchQemu9p ? false +, patchQemu9p ? false # until qemu 7.2.0 becomes available in nixpkgs }: -let - # 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 { +rec { nixosConfigurations.${name} = pkgs.nixos ({ modulesPath, lib, pkgs, ... }: { imports = [ @@ -68,8 +55,21 @@ in rec { # https://github.com/NixOS/nixpkgs/pull/200225 #restrictNetwork = lib.mkDefault true; - qemu.package = lib.mkDefault - (if patchQemu9p then qemu_kvm_patched_9p else pkgs.qemu_kvm); + # Patched QEMU to fix slow 9p file share. + # https://linus.schreibt.jetzt/posts/qemu-9p-performance.html + qemu.package = lib.mkDefault ( + if patchQemu9p then + 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="; + }) ]; + }) + else pkgs.qemu_kvm + ); + }; }); -- cgit v1.2.3