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
commit5d06f6933d5373f9f4c4ea63d03029869855f876
authorMartin Schwaighofer <mschwaig@users.noreply.github.com>
dateSun 6 Jun 2021, 12:45 (5 years ago)
parentf57e1a4
pkgs/applications/virtualization/qemu/default.nix+1−1
@@ -231,7 +231,7 @@ stdenv.mkDerivation rec {
231231 if [ -x $out/bin/qemu-system-${stdenv.hostPlatform.qemuArch} ]; then
232232 makeWrapper $out/bin/qemu-system-${stdenv.hostPlatform.qemuArch} \
233233 $out/bin/qemu-kvm \
234− --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)"
234+ --add-flags "\$([ -r /dev/kvm -a -w /dev/kvm ] && echo -enable-kvm)"
235235 fi
236236 '';
237237