From 9b9a5b6d5fc602c09d8f3534f89161c1730383b0 Mon Sep 17 00:00:00 2001 From: Mario Hros Date: Fri, 3 Feb 2023 22:01:14 +0100 Subject: [PATCH] openboardview: macos support --- .../electronics/openboardview/default.nix | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/science/electronics/openboardview/default.nix b/pkgs/applications/science/electronics/openboardview/default.nix index d4aa6e6dfc0b..9fd9d56295d8 100644 --- a/pkgs/applications/science/electronics/openboardview/default.nix +++ b/pkgs/applications/science/electronics/openboardview/default.nix @@ -9,8 +9,12 @@ , fontconfig , gtk3 , wrapGAppsHook +, darwin }: +let + inherit (darwin.apple_sdk.frameworks) Cocoa; +in stdenv.mkDerivation rec { pname = "openboardview"; version = "9.0.3"; @@ -24,11 +28,14 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake pkg-config python3 wrapGAppsHook ]; - buildInputs = [ SDL2 fontconfig gtk3 ]; + buildInputs = [ SDL2 fontconfig gtk3 ] ++ lib.optionals stdenv.isDarwin [ + Cocoa + ]; postPatch = '' substituteInPlace src/openboardview/CMakeLists.txt \ --replace "SDL2::SDL2main" "" + substituteInPlace CMakeLists.txt --replace "fixup_bundle" "#fixup_bundle" ''; cmakeFlags = [ @@ -37,9 +44,12 @@ stdenv.mkDerivation rec { ]; dontWrapGApps = true; - postFixup = '' - wrapGApp "$out/bin/${pname}" \ - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ gtk3 ]} + postFixup = lib.optionalString stdenv.isDarwin '' + mkdir -p "$out/Applications" + mv "$out/openboardview.app" "$out/Applications/OpenBoardView.app" + '' + lib.optionalString (!stdenv.isDarwin) '' + wrapGApp "$out/bin/${pname}" \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ gtk3 ]} ''; passthru.updateScript = gitUpdater { @@ -50,7 +60,7 @@ stdenv.mkDerivation rec { description = "Linux SDL/ImGui edition software for viewing .brd files"; homepage = "https://github.com/OpenBoardView/OpenBoardView"; license = licenses.mit; - platforms = platforms.linux; + platforms = platforms.unix; maintainers = with maintainers; [ k3a ]; }; }