mirror of
https://github.com/NixOS/nix
synced 2025-07-01 12:37:59 +02:00
Check requiredSystemFeatures for local builds
For example, this prevents a "kvm" build on machines that don't have KVM. Fixes #2012.
This commit is contained in:
parent
7ae7a38c9a
commit
1e7b8deea7
8 changed files with 79 additions and 16 deletions
|
@ -86,6 +86,21 @@ unsigned int Settings::getDefaultCores()
|
|||
return std::max(1U, std::thread::hardware_concurrency());
|
||||
}
|
||||
|
||||
StringSet Settings::getDefaultSystemFeatures()
|
||||
{
|
||||
/* For backwards compatibility, accept some "features" that are
|
||||
used in Nixpkgs to route builds to certain machines but don't
|
||||
actually require anything special on the machines. */
|
||||
StringSet features{"nixos-test", "benchmark", "big-parallel"};
|
||||
|
||||
#if __linux__
|
||||
if (access("/dev/kvm", R_OK | W_OK) == 0)
|
||||
features.insert("kvm");
|
||||
#endif
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
const string nixVersion = PACKAGE_VERSION;
|
||||
|
||||
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue