From d13aad60e5cdc8700df1cbc62f489ca1e7295f64 Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Tue, 5 Nov 2024 09:00:42 +0100 Subject: [PATCH] nanoboyadvance: Build the Darwin app bundle --- pkgs/by-name/na/nanoboyadvance/package.nix | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/na/nanoboyadvance/package.nix b/pkgs/by-name/na/nanoboyadvance/package.nix index 7edf601090d8..6b0efdc8b717 100644 --- a/pkgs/by-name/na/nanoboyadvance/package.nix +++ b/pkgs/by-name/na/nanoboyadvance/package.nix @@ -37,6 +37,11 @@ stdenv.mkDerivation (finalAttrs: { url = "https://github.com/nba-emu/NanoBoyAdvance/commit/f5551cc1aa6a12b3d65dd56d186c73a67f3d9dd6.patch"; hash = "sha256-TCyN0qz7o7BDhVZtaTsWCZAcKThi5oVqUM0NGmj44FI="; }) + (fetchpatch { + name = "fix-darwin-bundle-install-path.patch"; + url = "https://github.com/nba-emu/NanoBoyAdvance/commit/bd07a261141cd1f67b828d20f6d01a97adf91c16.patch"; + hash = "sha256-Nqz35PGfPBZ3Lg6szez4k3R/NkgObNndvbxY8JCY40Y"; + }) ]; nativeBuildInputs = [ @@ -53,13 +58,24 @@ stdenv.mkDerivation (finalAttrs: { libunarr ]; - cmakeFlags = [ - (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_GLAD" "${gladSrc}") - (lib.cmakeBool "USE_SYSTEM_FMT" true) - (lib.cmakeBool "USE_SYSTEM_TOML11" true) - (lib.cmakeBool "USE_SYSTEM_UNARR" true) - (lib.cmakeBool "PORTABLE_MODE" false) - ]; + cmakeFlags = + [ + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_GLAD" "${gladSrc}") + (lib.cmakeBool "USE_SYSTEM_FMT" true) + (lib.cmakeBool "USE_SYSTEM_TOML11" true) + (lib.cmakeBool "USE_SYSTEM_UNARR" true) + (lib.cmakeBool "PORTABLE_MODE" false) + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + (lib.cmakeBool "MACOS_BUILD_APP_BUNDLE" true) + (lib.cmakeBool "MACOS_BUNDLE_QT" false) + ]; + + # Make it runnable from the terminal on Darwin + postInstall = lib.optionals stdenv.hostPlatform.isDarwin '' + mkdir "$out/bin" + ln -s "$out/Applications/NanoBoyAdvance.app/Contents/MacOS/NanoBoyAdvance" "$out/bin/NanoBoyAdvance" + ''; meta = { description = "Cycle-accurate Nintendo Game Boy Advance emulator";