package.nix (2903B)
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 src = fetchfromgh { 37 owner = "sasgis"; 38 repo = "sas.planet.src"; 39 tag = "v.${finalAttrs.version}"; 40 hash = "sha256-RGoVyb8agoIwoHFvswBTmqt2nDXMugjAqPaL9jbF4GY="; 41 name = "SAS.Planet.Release.${finalAttrs.version}.x64.zip"; 42 }; 43 44 sourceRoot = "."; 45 46 nativeBuildInputs = [ 47 copyDesktopItems 48 makeWrapper 49 unzip 50 ]; 51 52 desktopItems = [ 53 (makeDesktopItem { 54 name = "sasplanet"; 55 type = "Application"; 56 desktopName = "SAS.Planet"; 57 icon = "sasplanet"; 58 exec = "sasplanet"; 59 terminal = false; 60 categories = [ 61 "Science" 62 "Maps" 63 "Geography" 64 ]; 65 }) 66 ]; 67 68 # Post install regedit: 69 # * increase font size: https://askubuntu.com/a/1313810 70 # * dark theme: https://gist.github.com/Zeinok/ceaf6ff204792dde0ae31e0199d89398 71 installPhase = '' 72 runHook preInstall 73 74 mkdir -p $out/opt/sasplanet 75 cp -r . $out/opt/sasplanet 76 install -Dm644 ${icon} $out/share/icons/hicolor/64x64/apps/sasplanet.png 77 78 makeWrapper ${wineWow64Packages.stable}/bin/wine $out/bin/sasplanet \ 79 --run "[ -d \$HOME/.sasplanet ] || { cp -r $out/opt/sasplanet \$HOME/.sasplanet && chmod -R +w \$HOME/.sasplanet; }" \ 80 --add-flags "\$HOME/.sasplanet/SASPlanet.exe" 81 82 ${lib.optionalString withMaps "cp -r ${maps}/* $out/opt/sasplanet/Maps/sas.maps"} 83 ${lib.optionalString withExtremum "unzip ${extremum} -d $out/opt/sasplanet/Maps/sas.maps"} 84 85 runHook postInstall 86 ''; 87 88 preferLocalBuild = true; 89 90 meta = { 91 description = "SAS.Planet is a program designed for viewing and downloading high-resolution satellite imagery and conventional maps"; 92 homepage = "http://www.sasgis.org/sasplaneta/"; 93 changelog = "http://www.sasgis.org/mantis/changelog_page.php"; 94 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 95 license = lib.licenses.gpl3Plus; 96 maintainers = [ lib.maintainers.sikmir ]; 97 platforms = lib.platforms.all; 98 mainProgram = "sasplanet"; 99 skip.ci = true; 100 }; 101 })
