From 09c1c255aa41e7364077256c8e6980b41e2b6784 Mon Sep 17 00:00:00 2001 From: Rhys-T <108157737+Rhys-T@users.noreply.github.com> Date: Thu, 8 May 2025 23:29:34 -0400 Subject: [PATCH] SDL_compat: fix build on Darwin Now that libGLU is `null` on macOS (#400427), the `install_name_tool` command was being passed `-add_rpath` without an actual path argument after it, and was throwing an error as a result. This change filters out any `null`s from `buildInputs` before building the command line. --- pkgs/by-name/sd/SDL_compat/package.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/sd/SDL_compat/package.nix b/pkgs/by-name/sd/SDL_compat/package.nix index 59788c98bbcf1..95a23567f99fa 100644 --- a/pkgs/by-name/sd/SDL_compat/package.nix +++ b/pkgs/by-name/sd/SDL_compat/package.nix @@ -70,15 +70,18 @@ stdenv.mkDerivation (finalAttrs: { for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do if [[ -L "$lib" ]]; then ${ + let + nonNullBuildInputs = builtins.filter (p: p != null) finalAttrs.buildInputs; + in if stdenv.hostPlatform.isDarwin then '' install_name_tool ${ - lib.strings.concatMapStrings (x: " -add_rpath ${lib.makeLibraryPath [ x ]} ") finalAttrs.buildInputs + lib.strings.concatMapStrings (x: " -add_rpath ${lib.makeLibraryPath [ x ]} ") nonNullBuildInputs } "$lib" '' else '' - patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath finalAttrs.buildInputs}" "$lib" + patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath nonNullBuildInputs}" "$lib" '' } fi