about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-04-15 02:15:35 +0300
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2023-04-15 03:10:34 +0300
commitb5eaa9ffd98d3dad25a1b60858bd2fbd68587a08 (patch)
treec11f88604e4286ef4511a327769d78ba4004a7b5 /pkgs/applications/science
parent83ed2b7e9a05a26e71a878793b8ca3a3e6212fef (diff)
stellarium: update darwin patches
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/astronomy/stellarium/default.nix22
1 files changed, 18 insertions, 4 deletions
diff --git a/pkgs/applications/science/astronomy/stellarium/default.nix b/pkgs/applications/science/astronomy/stellarium/default.nix
index c3880b0b1d2be..2b8d292eada0b 100644
--- a/pkgs/applications/science/astronomy/stellarium/default.nix
+++ b/pkgs/applications/science/astronomy/stellarium/default.nix
@@ -30,6 +30,14 @@ stdenv.mkDerivation rec {
     hash = "sha256-7jzS3pRklPsCTgCr3nrywfHCNlBDHuyuGGvrVoI9+A0=";
   };
 
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace CMakeLists.txt \
+      --replace 'SET(CMAKE_INSTALL_PREFIX "''${PROJECT_BINARY_DIR}/Stellarium.app/Contents")' \
+                'SET(CMAKE_INSTALL_PREFIX "${placeholder "out"}/Applications/Stellarium.app/Contents")'
+    substituteInPlace src/CMakeLists.txt \
+      --replace "\''${_qt_bin_dir}/../" "${qtmultimedia}/lib/qt-6/"
+  '';
+
   nativeBuildInputs = [
     cmake
     perl
@@ -44,22 +52,28 @@ stdenv.mkDerivation rec {
     qtmultimedia
     qtserialport
     qttranslations
-    qtwayland
     qtwebengine
     calcmysky
     qxlsx
     indilib
     libnova
+  ] ++ lib.optionals stdenv.isLinux [
+    qtwayland
   ];
 
   preConfigure = lib.optionalString stdenv.isDarwin ''
-    substituteInPlace CMakeLists.txt \
-      --replace 'SET(CMAKE_INSTALL_PREFIX "''${PROJECT_BINARY_DIR}/Stellarium.app/Contents")' \
-                'SET(CMAKE_INSTALL_PREFIX "${placeholder "out"}/Applications/Stellarium.app/Contents")'
+    export LC_ALL=en_US.UTF-8
   '';
 
+  # fatal error: 'QtSerialPort/QSerialPortInfo' file not found
+  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-F${qtserialport}/lib";
+
   dontWrapGApps = true;
 
+  postInstall = lib.optionalString stdenv.isDarwin ''
+    makeWrapper $out/Applications/Stellarium.app/Contents/MacOS/Stellarium $out/bin/stellarium
+  '';
+
   preFixup = ''
     qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
   '';