nixpkgs/pkgs/by-name/ma/mars-mips/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

72 lines
1.8 KiB
Nix

{ lib
, stdenv
, fetchurl
, makeBinaryWrapper
, copyDesktopItems
, makeDesktopItem
, desktopToDarwinBundle
, unzip
, imagemagick
, jre
}:
stdenv.mkDerivation (finalAttrs: {
pname = "mars-mips";
version = "4.5";
src = fetchurl {
url = "https://courses.missouristate.edu/KenVollmar/MARS/MARS_${lib.replaceStrings ["."] ["_"] finalAttrs.version}_Aug2014/Mars${lib.replaceStrings ["."] ["_"] finalAttrs.version}.jar";
hash = "sha256-rDQLZ2uitiJGud935i+BrURHvP0ymrU5cWvNCZULcJY=";
};
dontUnpack = true;
nativeBuildInputs = [
makeBinaryWrapper
copyDesktopItems
unzip
imagemagick
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
desktopToDarwinBundle
];
desktopItems = [
(makeDesktopItem {
name = "mars";
desktopName = "MARS";
exec = "Mars";
icon = "mars";
comment = finalAttrs.meta.description;
categories = [ "Development" "IDE" ];
})
];
installPhase = ''
runHook preInstall
export JAR=$out/share/java/mars/Mars.jar
install -Dm444 $src $JAR
makeWrapper ${jre}/bin/java $out/bin/Mars \
--add-flags "-jar $JAR"
unzip $src images/MarsThumbnail.gif
for size in 16 24 32 48 64 128 256 512
do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -resize "$size"x"$size" images/MarsThumbnail.gif $out/share/icons/hicolor/"$size"x"$size"/apps/mars.png
done
runHook postInstall
'';
meta = {
description = "An IDE for programming in MIPS assembly language intended for educational-level use";
mainProgram = "Mars";
homepage = "https://courses.missouristate.edu/KenVollmar/MARS/";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ emilytrau ];
platforms = lib.platforms.all;
};
})