1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 20:16:03 +01:00

Merge pull request #13852 from lovesegfault/warn-no-kvm

feat(libstore): warn when kvm is enabled but /dev/kvm isn't available
This commit is contained in:
Eelco Dolstra 2025-09-22 18:31:57 +02:00 committed by GitHub
commit a0103fc302
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,7 @@
# include "nix/store/personality.hh"
# include "nix/util/cgroup.hh"
# include "nix/util/linux-namespaces.hh"
# include "nix/util/logging.hh"
# include "linux/fchmodat2-compat.hh"
# include <sys/ioctl.h>
@ -505,8 +506,16 @@ struct ChrootLinuxDerivationBuilder : ChrootDerivationBuilder, LinuxDerivationBu
createDirs(chrootRootDir + "/dev/shm");
createDirs(chrootRootDir + "/dev/pts");
ss.push_back("/dev/full");
if (systemFeatures.count("kvm") && pathExists("/dev/kvm"))
if (systemFeatures.count("kvm")) {
if (pathExists("/dev/kvm")) {
ss.push_back("/dev/kvm");
} else {
warn(
"KVM is enabled in system-features but /dev/kvm is not available. "
"QEMU builds may fall back to slow emulation. "
"Consider removing 'kvm' from system-features in nix.conf if KVM is not supported on this system.");
}
}
ss.push_back("/dev/null");
ss.push_back("/dev/random");
ss.push_back("/dev/tty");