diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-10-13 11:45:30 -0700 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-10-13 11:46:16 -0700 |
commit | 96eb5ef156641ffc4c5ff01befe73a3419b346bc (patch) | |
tree | 28b2a55927b9b75cd384ac8e17ab83cd799676e2 /src | |
parent | 59a304a9a822467cecb5ee4d344c38e13711e78e (diff) |
Improve Rosetta detection
Turns out that one of those *.plist files can exist even if Rosetta is
not installed. So let's just try to run an x86_64-darwin binary
directly.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/globals.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index d724897bb..c3d5f9b8c 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -154,12 +154,12 @@ StringSet Settings::getDefaultExtraPlatforms() // machines. Note that we can’t force processes from executing // x86_64 in aarch64 environments or vice versa since they can // always exec with their own binary preferences. - if (pathExists("/Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist") || - pathExists("/System/Library/LaunchDaemons/com.apple.oahd.plist")) { - if (std::string{SYSTEM} == "x86_64-darwin") - extraPlatforms.insert("aarch64-darwin"); - else if (std::string{SYSTEM} == "aarch64-darwin") + if (std::string{SYSTEM} == "aarch64-darwin") { + if (runProgram(RunOptions {.program = "arch", .args = {"-arch", "x86_64", "/bin/pwd"}, .mergeStderrToStdout = true}).first == 0) { + debug("Rosetta detected"); extraPlatforms.insert("x86_64-darwin"); + } else + debug("Rosetta not detected"); } #endif |