forked from lix-project/lix
f69820417f
By default, once you enter x86_64 Rosetta 2, macOS will try to run everything in x86_64. So an x86_64 Nix will still try to use x86_64 even when system = aarch64-darwin. To avoid this we can set kern.curproc_arch_affinity sysctl. With kern.curproc_arch_affinity=0, we ignore this preference. This is based on how https://opensource.apple.com/source/system_cmds/system_cmds-880.40.5/arch.tproj/arch.c.auto.html works. Completely undocumented, but seems to work! Note, you can verify this works with this impure Nix expression: ``` { a = derivation { name = "a"; system = "aarch64-darwin"; builder = "/bin/sh"; args = [ "-e" (builtins.toFile "builder" '' [ "$(/usr/bin/arch)" = arm64 ] [ "$(/usr/bin/arch -arch x86_64 /bin/sh -c /usr/bin/arch)" = i386 ] [ "$(/usr/bin/arch -arch arm64 /bin/sh -c /usr/bin/arch)" = arm64 ] /usr/bin/touch $out '') ]; }; b = derivation { name = "b"; system = "x86_64-darwin"; builder = "/bin/sh"; args = [ "-e" (builtins.toFile "builder" '' [ "$(/usr/bin/arch)" = i386 ] [ "$(/usr/bin/arch -arch x86_64 /bin/sh -c /usr/bin/arch)" = i386 ] [ "$(/usr/bin/arch -arch arm64 /bin/sh -c /usr/bin/arch)" = arm64 ] /usr/bin/touch $out '') ]; }; } ``` |
||
---|---|---|
.. | ||
build | ||
builtins | ||
binary-cache-store.cc | ||
binary-cache-store.hh | ||
builtins.hh | ||
ca-specific-schema.sql | ||
content-address.cc | ||
content-address.hh | ||
crypto.cc | ||
crypto.hh | ||
daemon.cc | ||
daemon.hh | ||
derivations.cc | ||
derivations.hh | ||
dummy-store.cc | ||
export-import.cc | ||
filetransfer.cc | ||
filetransfer.hh | ||
fs-accessor.hh | ||
gc.cc | ||
globals.cc | ||
globals.hh | ||
http-binary-cache-store.cc | ||
legacy-ssh-store.cc | ||
local-binary-cache-store.cc | ||
local-fs-store.cc | ||
local-fs-store.hh | ||
local-store.cc | ||
local-store.hh | ||
local.mk | ||
lock.cc | ||
lock.hh | ||
machines.cc | ||
machines.hh | ||
misc.cc | ||
names.cc | ||
names.hh | ||
nar-accessor.cc | ||
nar-accessor.hh | ||
nar-info-disk-cache.cc | ||
nar-info-disk-cache.hh | ||
nar-info.cc | ||
nar-info.hh | ||
nix-store.pc.in | ||
optimise-store.cc | ||
parsed-derivations.cc | ||
parsed-derivations.hh | ||
path-info.hh | ||
path.cc | ||
path.hh | ||
pathlocks.cc | ||
pathlocks.hh | ||
profiles.cc | ||
profiles.hh | ||
realisation.cc | ||
realisation.hh | ||
references.cc | ||
references.hh | ||
remote-fs-accessor.cc | ||
remote-fs-accessor.hh | ||
remote-store.cc | ||
remote-store.hh | ||
s3-binary-cache-store.cc | ||
s3-binary-cache-store.hh | ||
s3.hh | ||
sandbox-defaults.sb | ||
sandbox-minimal.sb | ||
sandbox-network.sb | ||
schema.sql | ||
serve-protocol.hh | ||
sqlite.cc | ||
sqlite.hh | ||
ssh-store.cc | ||
ssh.cc | ||
ssh.hh | ||
store-api.cc | ||
store-api.hh | ||
uds-remote-store.cc | ||
uds-remote-store.hh | ||
worker-protocol.hh |