nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 122 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 cmake, 7 perl, 8 wrapGAppsHook3, 9 qt6, 10 qt6Packages, 11 calcmysky, 12 indilib, 13 libnova, 14 exiv2, 15 nlopt, 16 testers, 17 xvfb-run, 18 gitUpdater, 19 md4c, 20 withQtWebEngine ? lib.meta.availableOn stdenv.hostPlatform qt6.qtwebengine, 21}: 22 23stdenv.mkDerivation (finalAttrs: { 24 pname = "stellarium"; 25 version = "25.4"; 26 27 src = fetchFromGitHub { 28 owner = "Stellarium"; 29 repo = "stellarium"; 30 rev = "v${finalAttrs.version}"; 31 hash = "sha256-DA4VuVTVGTTzZA9ml+sh6R2qUU+QhHD9k1qOb8C5sSA="; 32 }; 33 34 patches = [ 35 (fetchpatch { 36 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/stellarium/-/raw/ab559b6e9349569278f83c2dfc83990e971a8cb2/qt-6.10.patch"; 37 hash = "sha256-a7zC9IQOj93VnPy8Bj/fLe4oJux7I4Edgj5OaKI4TZU="; 38 }) 39 ]; 40 41 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 42 substituteInPlace CMakeLists.txt \ 43 --replace-fail 'SET(CMAKE_INSTALL_PREFIX "''${PROJECT_BINARY_DIR}/Stellarium.app/Contents")' \ 44 'SET(CMAKE_INSTALL_PREFIX "${placeholder "out"}/Applications/Stellarium.app/Contents")' 45 substituteInPlace src/CMakeLists.txt \ 46 --replace-fail "\''${_qt_bin_dir}/../" "${qt6.qtmultimedia}/lib/qt-6/" 47 ''; 48 49 nativeBuildInputs = [ 50 cmake 51 perl 52 wrapGAppsHook3 53 qt6.wrapQtAppsHook 54 qt6.qttools 55 ]; 56 57 buildInputs = [ 58 qt6.qtbase 59 qt6.qtcharts 60 qt6.qtpositioning 61 qt6.qtmultimedia 62 qt6.qtserialport 63 calcmysky 64 qt6Packages.qxlsx 65 indilib 66 libnova 67 exiv2 68 md4c 69 nlopt 70 ] 71 ++ lib.optionals stdenv.hostPlatform.isLinux [ 72 qt6.qtwayland 73 ] 74 ++ lib.optionals withQtWebEngine [ 75 qt6.qtwebengine 76 ]; 77 78 preConfigure = '' 79 export SOURCE_DATE_EPOCH=$(date -d 20${lib.versions.major finalAttrs.version}0101 +%s) 80 '' 81 + lib.optionalString stdenv.hostPlatform.isDarwin '' 82 export LC_ALL=en_US.UTF-8 83 ''; 84 85 # fatal error: 'QtSerialPort/QSerialPortInfo' file not found 86 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-F${qt6.qtserialport}/lib"; 87 88 dontWrapGApps = true; 89 90 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' 91 makeWrapper $out/Applications/Stellarium.app/Contents/MacOS/Stellarium $out/bin/stellarium 92 ''; 93 94 preFixup = '' 95 qtWrapperArgs+=("''${gappsWrapperArgs[@]}") 96 ''; 97 98 passthru = { 99 tests.version = testers.testVersion { 100 package = finalAttrs.finalPackage; 101 command = '' 102 # Create a temporary home directory because stellarium aborts with an 103 # error if it can't write some configuration files. 104 tmpdir=$(mktemp -d) 105 106 # stellarium can't be run in headless mode, therefore we need xvfb-run. 107 HOME="$tmpdir" ${lib.getExe xvfb-run} stellarium --version 108 ''; 109 }; 110 updateScript = gitUpdater { rev-prefix = "v"; }; 111 }; 112 113 meta = { 114 description = "Free open-source planetarium"; 115 mainProgram = "stellarium"; 116 homepage = "https://stellarium.org/"; 117 license = lib.licenses.gpl2Plus; 118 platforms = lib.platforms.unix; 119 maintainers = with lib.maintainers; [ kilianar ]; 120 broken = stdenv.hostPlatform.isDarwin; 121 }; 122})