diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2020-12-03 15:35:38 -0600 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2020-12-03 15:41:43 -0600 |
commit | 9b1824ecbd222b4bdc8fa2b6f345dc55ef4872d0 (patch) | |
tree | 1ad5f555cad53d7a1838931b903b14d575655353 /src/libstore/globals.hh | |
parent | 6ed09cb8c2c27f30bec1eccb153db80dc5a77520 (diff) |
Add extraPlatforms for Rosetta 2 macOS
macOS systems with ARM64 can utilize a translation layer at
/Library/Apple/usr/libexec/oah to run x86_64 binaries. This change
makes Nix recognize that and it to "extra-platforms". Note that there
are two cases here since Nix could be built for either x86_64 or
aarch64. In either case, we can switch to the other architecture.
Unfortunately there is not a good way to prevent aarch64 binaries from
being run in x86_64 contexts or vice versa - programs can always
execute programs for the other architecture.
Diffstat (limited to 'src/libstore/globals.hh')
-rw-r--r-- | src/libstore/globals.hh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 4655ca058..8666a7d28 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -34,6 +34,8 @@ class Settings : public Config { StringSet getDefaultSystemFeatures(); + StringSet getDefaultExtraPlatforms(); + bool isWSL1(); public: @@ -545,7 +547,7 @@ public: Setting<StringSet> extraPlatforms{ this, - std::string{SYSTEM} == "x86_64-linux" && !isWSL1() ? StringSet{"i686-linux"} : StringSet{}, + getDefaultExtraPlatforms(), "extra-platforms", R"( Platforms other than the native one which this machine is capable of |