mars-mips: add darwin bundle

+42 -22
+42 -22
pkgs/development/tools/mars-mips/default.nix
··· 1 - { lib, stdenvNoCC, fetchurl, makeWrapper, copyDesktopItems, makeDesktopItem, unzip, imagemagick, jre }: 2 3 - stdenvNoCC.mkDerivation rec { 4 pname = "mars-mips"; 5 version = "4.5"; 6 7 src = fetchurl { 8 - url = "https://courses.missouristate.edu/KenVollmar/MARS/MARS_${lib.replaceStrings ["."] ["_"] version}_Aug2014/Mars${lib.replaceStrings ["."] ["_"] version}.jar"; 9 - sha256 = "15kh1fahkkbbf4wvb6ijzny4fi5dh4pycxyzp5325dm2ddkhnd5c"; 10 }; 11 12 dontUnpack = true; 13 14 - nativeBuildInputs = [ makeWrapper copyDesktopItems unzip imagemagick ]; 15 16 desktopItems = [ 17 (makeDesktopItem { 18 - name = pname; 19 desktopName = "MARS"; 20 - exec = "mars-mips"; 21 - icon = "mars-mips"; 22 - comment = "An IDE for programming in MIPS assembly language"; 23 categories = [ "Development" "IDE" ]; 24 }) 25 ]; ··· 27 installPhase = '' 28 runHook preInstall 29 30 - export JAR=$out/share/java/${pname}/${pname}.jar 31 - install -D $src $JAR 32 - makeWrapper ${jre}/bin/java $out/bin/${pname} \ 33 --add-flags "-jar $JAR" 34 35 - unzip ${src} images/MarsThumbnail.gif 36 - mkdir -p $out/share/pixmaps 37 - convert images/MarsThumbnail.gif $out/share/pixmaps/mars-mips.png 38 39 runHook postInstall 40 ''; 41 42 - meta = with lib; { 43 description = "An IDE for programming in MIPS assembly language intended for educational-level use"; 44 - mainProgram = "mars-mips"; 45 homepage = "https://courses.missouristate.edu/KenVollmar/MARS/"; 46 - sourceProvenance = with sourceTypes; [ binaryBytecode ]; 47 - license = licenses.mit; 48 - maintainers = with maintainers; [ emilytrau ]; 49 - platforms = platforms.all; 50 }; 51 - }
··· 1 + { lib 2 + , stdenv 3 + , fetchurl 4 + , makeBinaryWrapper 5 + , copyDesktopItems 6 + , makeDesktopItem 7 + , desktopToDarwinBundle 8 + , unzip 9 + , imagemagick 10 + , jre 11 + }: 12 13 + stdenv.mkDerivation (finalAttrs: { 14 pname = "mars-mips"; 15 version = "4.5"; 16 17 src = fetchurl { 18 + url = "https://courses.missouristate.edu/KenVollmar/MARS/MARS_${lib.replaceStrings ["."] ["_"] finalAttrs.version}_Aug2014/Mars${lib.replaceStrings ["."] ["_"] finalAttrs.version}.jar"; 19 + hash = "sha256-rDQLZ2uitiJGud935i+BrURHvP0ymrU5cWvNCZULcJY="; 20 }; 21 22 dontUnpack = true; 23 24 + nativeBuildInputs = [ 25 + makeBinaryWrapper 26 + copyDesktopItems 27 + unzip 28 + imagemagick 29 + ] ++ lib.optionals stdenv.isDarwin [ 30 + desktopToDarwinBundle 31 + ]; 32 33 desktopItems = [ 34 (makeDesktopItem { 35 + name = "mars"; 36 desktopName = "MARS"; 37 + exec = "Mars"; 38 + icon = "mars"; 39 + comment = finalAttrs.meta.description; 40 categories = [ "Development" "IDE" ]; 41 }) 42 ]; ··· 44 installPhase = '' 45 runHook preInstall 46 47 + export JAR=$out/share/java/mars/Mars.jar 48 + install -Dm444 $src $JAR 49 + makeWrapper ${jre}/bin/java $out/bin/Mars \ 50 --add-flags "-jar $JAR" 51 52 + unzip $src images/MarsThumbnail.gif 53 + for size in 16 24 32 48 64 128 256 512 54 + do 55 + mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps 56 + convert -resize "$size"x"$size" images/MarsThumbnail.gif $out/share/icons/hicolor/"$size"x"$size"/apps/mars.png 57 + done 58 59 runHook postInstall 60 ''; 61 62 + meta = { 63 description = "An IDE for programming in MIPS assembly language intended for educational-level use"; 64 + mainProgram = "Mars"; 65 homepage = "https://courses.missouristate.edu/KenVollmar/MARS/"; 66 + sourceProvenance = with lib.sourceTypes; [ binaryBytecode ]; 67 + license = lib.licenses.mit; 68 + maintainers = with lib.maintainers; [ emilytrau ]; 69 + platforms = lib.platforms.all; 70 }; 71 + })