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