1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-17 16:02:43 +01:00

feat(libstore): warn when kvm is enabled but /dev/kvm isn't available

This commit is contained in:
Bernardo Meurer Costa 2025-08-27 22:19:07 +00:00
parent c2782d7b84
commit f193bca595

View file

@ -3,6 +3,7 @@
# include "nix/store/personality.hh" # include "nix/store/personality.hh"
# include "nix/util/cgroup.hh" # include "nix/util/cgroup.hh"
# include "nix/util/linux-namespaces.hh" # include "nix/util/linux-namespaces.hh"
# include "nix/util/logging.hh"
# include "linux/fchmodat2-compat.hh" # include "linux/fchmodat2-compat.hh"
# include <sys/ioctl.h> # include <sys/ioctl.h>
@ -492,8 +493,16 @@ struct ChrootLinuxDerivationBuilder : ChrootDerivationBuilder, LinuxDerivationBu
createDirs(chrootRootDir + "/dev/shm"); createDirs(chrootRootDir + "/dev/shm");
createDirs(chrootRootDir + "/dev/pts"); createDirs(chrootRootDir + "/dev/pts");
ss.push_back("/dev/full"); ss.push_back("/dev/full");
if (systemFeatures.count("kvm") && pathExists("/dev/kvm")) if (systemFeatures.count("kvm")) {
ss.push_back("/dev/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/null");
ss.push_back("/dev/random"); ss.push_back("/dev/random");
ss.push_back("/dev/tty"); ss.push_back("/dev/tty");