From d51714f72b47c3fa097ec0efaa223556538a3441 Mon Sep 17 00:00:00 2001 From: Kirill Radzikhovskyy Date: Thu, 9 Apr 2026 20:40:30 +1000 Subject: [PATCH] flightgear: darwin support --- .../flightgear/openscenegraph-flightgear.nix | 5 +- pkgs/by-name/fl/flightgear/package.nix | 51 ++++++++++++------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/pkgs/by-name/fl/flightgear/openscenegraph-flightgear.nix b/pkgs/by-name/fl/flightgear/openscenegraph-flightgear.nix index 858d1f0907d7..7cbbb965b2de 100644 --- a/pkgs/by-name/fl/flightgear/openscenegraph-flightgear.nix +++ b/pkgs/by-name/fl/flightgear/openscenegraph-flightgear.nix @@ -78,7 +78,10 @@ stdenv.mkDerivation { }) ]; - cmakeFlags = [ "-DBUILD_OSG_APPLICATIONS=OFF" ]; + cmakeFlags = [ + (lib.cmakeBool "BUILD_OSG_APPLICATIONS" false) + ] + ++ lib.optional stdenv.hostPlatform.isDarwin (lib.cmakeFeature "OSG_WINDOWING_SYSTEM" "Cocoa"); meta = { description = "3D graphics toolkit"; diff --git a/pkgs/by-name/fl/flightgear/package.nix b/pkgs/by-name/fl/flightgear/package.nix index 8ab1960ae548..514705cf3d3a 100644 --- a/pkgs/by-name/fl/flightgear/package.nix +++ b/pkgs/by-name/fl/flightgear/package.nix @@ -20,6 +20,7 @@ libxmu, libxt, simgear, + xz, zlib, boost, cmake, @@ -72,15 +73,29 @@ stdenv.mkDerivation rec { qt5.wrapQtAppsHook ]; buildInputs = [ - libglut freealut + libjpeg + openal + plib + (simgear.override { openscenegraph = openscenegraph; }) + zlib + boost + libpng + fltk_1_3 + apr + qt5.qtbase + qt5.qtquickcontrols2 + glew + qt5.qtdeclarative + curl + openscenegraph + xz + ] + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + libglut libGLU libGL libice - libjpeg - openal - openscenegraph - plib libsm libunwind libx11 @@ -89,25 +104,27 @@ stdenv.mkDerivation rec { libxi libxmu libxt - (simgear.override { openscenegraph = openscenegraph; }) - zlib - boost - libpng udev - fltk_1_3 - apr - qt5.qtbase - qt5.qtquickcontrols2 - glew - qt5.qtdeclarative - curl ]; + cmakeFlags = lib.optional stdenv.hostPlatform.isDarwin ( + lib.cmakeFeature "CMAKE_OSX_DEPLOYMENT_TARGET" "11.0" + ); + qtWrapperArgs = [ "--set FG_ROOT ${data}/share/FlightGear" ]; postInstall = '' # Remove redundant AppImage artifacts rm -rf "$out/appdir" + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + # The bundle copies OSG dylib dangling symlinks + rm -rf "$out/FlightGear.app/Contents/Frameworks" + # Place app bundle where macOS expects it + mkdir -p "$out/Applications" + mv "$out/FlightGear.app" "$out/Applications/" + # Provide fgfs in bin/ for CLI use, pointing into the bundle + ln -s "$out/Applications/FlightGear.app/Contents/MacOS/FlightGear" "$out/bin/fgfs" ''; passthru.updateScript = nix-update-script { }; @@ -118,7 +135,7 @@ stdenv.mkDerivation rec { raskin kirillrdy ]; - platforms = lib.platforms.linux; + platforms = lib.platforms.linux ++ lib.platforms.darwin; hydraPlatforms = [ ]; # disabled from hydra because it's so big license = lib.licenses.gpl2Plus; mainProgram = "fgfs";