1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-02 21:51:50 +02:00

Merge branch 'aarch64-armv7' of git://github.com/lheckemann/nix

Support extra compatible architectures (#1916)
This commit is contained in:
Shea Levy 2018-04-23 08:48:22 -04:00
commit 8e6108ff71
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27
5 changed files with 35 additions and 11 deletions

View file

@ -98,7 +98,9 @@ int main (int argc, char * * argv)
source >> drvPath;
auto requiredFeatures = readStrings<std::set<std::string>>(source);
auto canBuildLocally = amWilling && (neededSystem == settings.thisSystem);
auto canBuildLocally = amWilling
&& ( neededSystem == settings.thisSystem
|| settings.extraPlatforms.get().count(neededSystem) > 0);
/* Error ignored here, will be caught later */
mkdir(currentLoad.c_str(), 0777);

View file

@ -2499,6 +2499,10 @@ void setupSeccomp()
seccomp_arch_add(ctx, SCMP_ARCH_X32) != 0)
throw SysError("unable to add X32 seccomp architecture");
if (settings.thisSystem == "aarch64-linux" &&
seccomp_arch_add(ctx, SCMP_ARCH_ARM) != 0)
printError("unsable to add ARM seccomp architecture; this may result in spurious build failures if running 32-bit ARM processes.");
/* Prevent builders from creating setuid/setgid binaries. */
for (int perm : { S_ISUID, S_ISGID }) {
if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(chmod), 1,

View file

@ -57,16 +57,8 @@ bool BasicDerivation::isBuiltin() const
bool BasicDerivation::canBuildLocally() const
{
return platform == settings.thisSystem
|| isBuiltin()
#if __linux__
|| (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
;
|| settings.extraPlatforms.get().count(platform) > 0
|| isBuiltin();
}

View file

@ -295,6 +295,13 @@ public:
"Nix store has a valid signature (that is, one signed using a key "
"listed in 'trusted-public-keys'."};
Setting<StringSet> extraPlatforms{this,
SYSTEM == "x86_64-linux" ? StringSet{"i686-linux"} : StringSet{},
"extra-platforms",
"Additional platforms that can be built on the local system. "
"These may be supported natively (e.g. armv7 on some aarch64 CPUs "
"or using hacks like qemu-user."};
Setting<Strings> substituters{this,
nixStore == "/nix/store" ? Strings{"https://cache.nixos.org/"} : Strings(),
"substituters",