package.nix (2932B)
1 { 2 lib, 3 stdenv, 4 fetchfromgh, 5 fetchgdrive, 6 fetchgit, 7 fetchurl, 8 copyDesktopItems, 9 makeDesktopItem, 10 unzip, 11 wineWow64Packages, 12 makeWrapper, 13 withMaps ? true, 14 withExtremum ? false, 15 }: 16 let 17 maps = fetchgit { 18 url = "http://parasite.kicks-ass.org:3000/sasgis/maps.git"; 19 rev = "9b988fd8f39a5d0c44c2002d41735d2fe5a55b04"; 20 hash = "sha256-pxMlVM0w0+yZttSiCt96tLe9Lx/Lmea/txyQhy12AHM="; 21 }; 22 extremum = fetchgdrive { 23 id = "12PM_mEE8Xck036vXd5TAzPsUZeCnztJ5"; 24 hash = "sha256-6ZF4PsEFEGYt85umWJ/ToBW3JdeKEF4n6uU73hU8oLs="; 25 name = "Extremum.zip"; 26 }; 27 icon = fetchurl { 28 url = "https://raw.githubusercontent.com/sasgis/sas.planet.src/8f8c9aedd9a641feec419a5609474d3a75cc24c9/Resources/MainIcon/icon64.png"; 29 hash = "sha256-KQR5fGrF6cLBDeIEVmU+YPQIdzFn43NrPLbTqGAKhp0="; 30 }; 31 in 32 stdenv.mkDerivation (finalAttrs: { 33 pname = "sasplanet"; 34 version = "260101"; 35 36 __structuredAttrs = true; 37 38 src = fetchfromgh { 39 owner = "sasgis"; 40 repo = "sas.planet.src"; 41 tag = "v.${finalAttrs.version}"; 42 hash = "sha256-RGoVyb8agoIwoHFvswBTmqt2nDXMugjAqPaL9jbF4GY="; 43 name = "SAS.Planet.Release.${finalAttrs.version}.x64.zip"; 44 }; 45 46 sourceRoot = "."; 47 48 nativeBuildInputs = [ 49 copyDesktopItems 50 makeWrapper 51 unzip 52 ]; 53 54 desktopItems = [ 55 (makeDesktopItem { 56 name = "sasplanet"; 57 type = "Application"; 58 desktopName = "SAS.Planet"; 59 icon = "sasplanet"; 60 exec = "sasplanet"; 61 terminal = false; 62 categories = [ 63 "Science" 64 "Maps" 65 "Geography" 66 ]; 67 }) 68 ]; 69 70 # Post install regedit: 71 # * increase font size: https://askubuntu.com/a/1313810 72 # * dark theme: https://gist.github.com/Zeinok/ceaf6ff204792dde0ae31e0199d89398 73 installPhase = '' 74 runHook preInstall 75 76 mkdir -p $out/opt/sasplanet 77 cp -r . $out/opt/sasplanet 78 install -Dm644 ${icon} $out/share/icons/hicolor/64x64/apps/sasplanet.png 79 80 makeWrapper ${wineWow64Packages.stable}/bin/wine $out/bin/sasplanet \ 81 --run "[ -d \$HOME/.sasplanet ] || { cp -r $out/opt/sasplanet \$HOME/.sasplanet && chmod -R +w \$HOME/.sasplanet; }" \ 82 --add-flags "\$HOME/.sasplanet/SASPlanet.exe" 83 84 ${lib.optionalString withMaps "cp -r ${maps}/* $out/opt/sasplanet/Maps/sas.maps"} 85 ${lib.optionalString withExtremum "unzip ${extremum} -d $out/opt/sasplanet/Maps/sas.maps"} 86 87 runHook postInstall 88 ''; 89 90 preferLocalBuild = true; 91 92 meta = { 93 description = "SAS.Planet is a program designed for viewing and downloading high-resolution satellite imagery and conventional maps"; 94 homepage = "http://www.sasgis.org/sasplaneta/"; 95 changelog = "http://www.sasgis.org/mantis/changelog_page.php"; 96 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 97 license = lib.licenses.gpl3Plus; 98 maintainers = [ lib.maintainers.sikmir ]; 99 platforms = lib.platforms.all; 100 mainProgram = "sasplanet"; 101 skip.ci = true; 102 }; 103 })
