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