From 5d06f6933d5373f9f4c4ea63d03029869855f876 Mon Sep 17 00:00:00 2001 From: Martin Schwaighofer Date: Sun, 6 Jun 2021 12:45:40 +0200 Subject: [PATCH] qemu, runInLinuxVM: fix KVM availability check KVM should only be considered abailable if /dev/kvm exists and is read-writable by the user that is trying to launch it. The previous check for existance only had the consequence that on some Linux distributions running VMs with Nix's QEMU only worked if KVM was NOT installed. fixes #124371 --- pkgs/applications/virtualization/qemu/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index 93a215f1003b..7e89871786d6 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -231,7 +231,7 @@ stdenv.mkDerivation rec { if [ -x $out/bin/qemu-system-${stdenv.hostPlatform.qemuArch} ]; then makeWrapper $out/bin/qemu-system-${stdenv.hostPlatform.qemuArch} \ $out/bin/qemu-kvm \ - --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)" + --add-flags "\$([ -r /dev/kvm -a -w /dev/kvm ] && echo -enable-kvm)" fi '';