Add build-extra-platforms setting
This allows specifying additional systems that a machine is able to build for. This may apply on some armv7-capable aarch64 processors, or on systems using qemu-user with binfmt-misc to support transparent execution of foreign-arch programs. This removes the previous hard-coded assumptions about which systems are ABI-compatible with which other systems, and instead relies on the user to specify any additional platforms that they have ensured compatibility for and wish to build for locally. NixOS should probably add i686-linux on x86_64-linux systems for this setting by default.
This commit is contained in:
parent
24ec750003
commit
eb03a296c1
|
@ -57,16 +57,8 @@ bool BasicDerivation::isBuiltin() const
|
||||||
bool BasicDerivation::canBuildLocally() const
|
bool BasicDerivation::canBuildLocally() const
|
||||||
{
|
{
|
||||||
return platform == settings.thisSystem
|
return platform == settings.thisSystem
|
||||||
|| isBuiltin()
|
|| settings.extraPlatforms.get().count(platform) > 0
|
||||||
#if __linux__
|
|| isBuiltin();
|
||||||
|| (platform == "i686-linux" && settings.thisSystem == "x86_64-linux")
|
|
||||||
|| (platform == "armv6l-linux" && settings.thisSystem == "armv7l-linux")
|
|
||||||
|| (platform == "armv5tel-linux" && (settings.thisSystem == "armv7l-linux" || settings.thisSystem == "armv6l-linux"))
|
|
||||||
#elif __FreeBSD__
|
|
||||||
|| (platform == "i686-linux" && settings.thisSystem == "x86_64-freebsd")
|
|
||||||
|| (platform == "i686-linux" && settings.thisSystem == "i686-freebsd")
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,9 @@ public:
|
||||||
"Nix store has a valid signature (that is, one signed using a key "
|
"Nix store has a valid signature (that is, one signed using a key "
|
||||||
"listed in 'trusted-public-keys'."};
|
"listed in 'trusted-public-keys'."};
|
||||||
|
|
||||||
|
Setting<StringSet> extraPlatforms{this, StringSet{}, "build-extra-platforms",
|
||||||
|
"Additional platforms that can be built on the local system, e.g. using qemu-user."};
|
||||||
|
|
||||||
Setting<Strings> substituters{this,
|
Setting<Strings> substituters{this,
|
||||||
nixStore == "/nix/store" ? Strings{"https://cache.nixos.org/"} : Strings(),
|
nixStore == "/nix/store" ? Strings{"https://cache.nixos.org/"} : Strings(),
|
||||||
"substituters",
|
"substituters",
|
||||||
|
|
Loading…
Reference in a new issue