1{ lib, stdenv, fetchurl, makeWrapper, jre, gcc, valgrind }:
2# gcc and valgrind are not strict dependencies, they could be made
3# optional. They are here because plm can only help you learn C if you
4# have them installed.
5stdenv.mkDerivation rec {
6 pname = "plm";
7 version = "2.9.3";
8
9 src = fetchurl {
10 url = "https://github.com/BuggleInc/PLM/releases/download/v${version}/plm-${version}.jar";
11 sha256 = "0i9ghx9pm3kpn9x9n1hl10zdr36v5mv3drx8lvhsqwhlsvz42p5i";
12 name = "${pname}-${version}.jar";
13 };
14
15 nativeBuildInputs = [ makeWrapper ];
16 buildInputs = [ jre gcc valgrind ];
17
18 dontUnpack = true;
19
20 installPhase = ''
21 runHook preInstall
22
23 mkdir -p "$prefix/bin"
24
25 makeWrapper ${jre}/bin/java $out/bin/plm \
26 --add-flags "-jar $src" \
27 --prefix PATH : "$PATH"
28
29 runHook postInstall
30 '';
31
32 meta = with lib; {
33 description = "Free cross-platform programming exerciser";
34 homepage = "http://people.irisa.fr/Martin.Quinson/Teaching/PLM/";
35 license = licenses.gpl3;
36 sourceProvenance = with sourceTypes; [ binaryBytecode ];
37 maintainers = [ ];
38 platforms = lib.platforms.all;
39 };
40}