From ec50b11d4f542ed0a0916122032cce7a6a8e5dd4 Mon Sep 17 00:00:00 2001 From: Robert Stefanic Date: Tue, 29 Jul 2025 09:36:36 -0400 Subject: [PATCH] odin: Fix arm64-apple-darwin builds When installed on Apple Silicon, the Odin compiler will emit a warning everytime it runs a build. The warning is that `supplying the --target arm64-apple-macosx != arm64-apple-darwin argument to a nix-wrapped`. This is because the Odin compiler uses the target name "arm64-apple-macosx" while the nix-wrapped C compiler uses "arm64-apple-darwin". The warning is emitted here: https://github.com/NixOS/nixpkgs/blob/6770f4556182b1c83bb583eadaeef41902b30d53/pkgs/build-support/cc-wrapper/add-clang-cc-cflags-before.sh#L30 This patch fixes the warning by changing the target name used by the Odin compiler to match the nix-wrapped C compiler. --- pkgs/by-name/od/odin/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/od/odin/package.nix b/pkgs/by-name/od/odin/package.nix index b6d40051e0cc..731fe7e8aaa9 100644 --- a/pkgs/by-name/od/odin/package.nix +++ b/pkgs/by-name/od/odin/package.nix @@ -29,7 +29,15 @@ stdenv.mkDerivation (finalAttrs: { # which can be provided by a pure Nix expression, for example in a shell. ./system-raylib.patch ]; + postPatch = '' + # Odin is still using 'arm64-apple-macos' as the target name on + # aarch64-darwin architectures. This results in a warning whenever the + # Odin compiler runs a build. Replacing the target in the Odin compiler + # removes the nix warning when the Odin compiler is ran on aarch64-darwin. + substituteInPlace src/build_settings.cpp \ + --replace-fail "arm64-apple-macosx" "arm64-apple-darwin" + rm -r vendor/raylib/{linux,macos,macos-arm64,wasm,windows} patchShebangs --build build_odin.sh