From c0de9821ef1aebb98f2b1105fdd496e67f41e925 Mon Sep 17 00:00:00 2001 From: Redvers Davies Date: Wed, 18 Feb 2026 00:57:09 +0000 Subject: [PATCH] ponyc: Fixes code generation to use generic arch, not native Previous to this commit, code generated by the pony compiler would default to "native" as a cpu and march, resulting in code that would use opcodes native to the hydra build system, but potentially not the end-user's machine. Fixes: #414174 --- pkgs/by-name/po/ponyc/package.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/by-name/po/ponyc/package.nix b/pkgs/by-name/po/ponyc/package.nix index ede259fbab2c..504a975c7ed1 100644 --- a/pkgs/by-name/po/ponyc/package.nix +++ b/pkgs/by-name/po/ponyc/package.nix @@ -99,6 +99,20 @@ stdenv.mkDerivation rec { --replace-fail "https://github.com/google/googletest/releases/download/v$googletestRev/googletest-$googletestRev.tar.gz" "$NIX_BUILD_TOP/deps/googletest-$googletestRev.tar" ''; + # We do not concern ourselves with darwin as the ponyc compiler + # has logic which overrides this environmental variable in this + # case. + env.arch = + if stdenv.hostPlatform.isx86_64 then + "x86-64" + else if stdenv.hostPlatform.isAarch64 then + "armv8-a" + else + lib.warn '' + architecture '${stdenv.hostPlatform.system}' compiles with native optimizations, + this may result in crashes on incompatible CPUs! + '' "native"; + preBuild = '' extraFlags=(build_flags=-j$NIX_BUILD_CORES) ''