Skip to content

Commit

Permalink
Add build-extra-platforms setting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lheckemann committed Feb 27, 2018
1 parent 24ec750 commit eb03a29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/libstore/derivations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


Expand Down
3 changes: 3 additions & 0 deletions src/libstore/globals.hh
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ public:
"Nix store has a valid signature (that is, one signed using a key "
"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,
nixStore == "/nix/store" ? Strings{"https://cache.nixos.org/"} : Strings(),
"substituters",
Expand Down

0 comments on commit eb03a29

Please sign in to comment.