@@ -1,18 +1,7 @@
1−{ stdenv, fetchurl, jre, makeDesktopItem, makeWrapper, language ? "en_US" }:
2−
3−stdenv.mkDerivation rec {
1+{ stdenv, fetchurl, jre, makeDesktopItem, makeWrapper, unzip, language ? "en_US" }:
2+let
43 pname = "geogebra";
5− version = "5-0-593-0";
6−
7− preferLocalBuild = true;
8−
9− src = fetchurl {
10− urls = [
11− "https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
12− "http://web.archive.org/https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
13− ];
14− sha256 = "d84c27a3299e6df08881733d22215a18decedcba4c2d97a9e5424c39cd57db35";
15− };
4+ version = "5-0-609-0";
165
176 srcIcon = fetchurl {
187 url = "http://static.geogebra.org/images/geogebra-logo.svg";
@@ -30,23 +19,6 @@ stdenv.mkDerivation rec {
3019 mimeType = "application/vnd.geogebra.file;application/vnd.geogebra.tool;";
3120 };
3221
33− buildInputs = [ makeWrapper ];
34−
35− installPhase = ''
36− install -D geogebra/* -t "$out/libexec/geogebra/"
37−
38− makeWrapper "$out/libexec/geogebra/geogebra" "$out/bin/geogebra" \
39− --set JAVACMD "${jre}/bin/java" \
40− --set GG_PATH "$out/libexec/geogebra" \
41− --add-flags "--language=${language}"
42−
43− install -Dm644 "${desktopItem}/share/applications/"* \
44− -t $out/share/applications/
45−
46− install -Dm644 "${srcIcon}" \
47− "$out/share/icons/hicolor/scalable/apps/geogebra.svg"
48− '';
49−
5022 meta = with stdenv.lib; {
5123 description = "Dynamic mathematics software with graphics, algebra and spreadsheets";
5224 longDescription = ''
@@ -57,7 +29,61 @@ stdenv.mkDerivation rec {
5729 homepage = "https://www.geogebra.org/";
5830 maintainers = with maintainers; [ ma27 ];
5931 license = with licenses; [ gpl3 cc-by-nc-sa-30 geogebra ];
60− platforms = platforms.all;
32+ platforms = with platforms; linux ++ darwin;
6133 hydraPlatforms = [];
6234 };
63−}
35+
36+ linuxPkg = stdenv.mkDerivation {
37+ inherit pname version meta srcIcon desktopItem;
38+
39+ preferLocalBuild = true;
40+
41+ src = fetchurl {
42+ urls = [
43+ "https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
44+ "http://web.archive.org/web/20201022200454/https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
45+ ];
46+ sha256 = "0xbhg8hm3dqm3qkraj48pqwslrnjyxpq9mcgylr2m8i1gmqw7xwf";
47+ };
48+
49+ nativeBuildInputs = [ makeWrapper ];
50+
51+ installPhase = ''
52+ install -D geogebra/* -t "$out/libexec/geogebra/"
53+
54+ makeWrapper "$out/libexec/geogebra/geogebra" "$out/bin/geogebra" \
55+ --set JAVACMD "${jre}/bin/java" \
56+ --set GG_PATH "$out/libexec/geogebra" \
57+ --add-flags "--language=${language}"
58+
59+ install -Dm644 "${desktopItem}/share/applications/"* \
60+ -t $out/share/applications/
61+
62+ install -Dm644 "${srcIcon}" \
63+ "$out/share/icons/hicolor/scalable/apps/geogebra.svg"
64+ '';
65+ };
66+
67+ darwinPkg = stdenv.mkDerivation {
68+ inherit pname version meta;
69+
70+ preferLocalBuild = true;
71+
72+ src = fetchurl {
73+ url = "https://download.geogebra.org/installers/5.0/GeoGebra-MacOS-Installer-withJava-${version}.zip";
74+ sha256 = "16fgqwxz31cfmia0pyzpk05aqzrqr11sjbw37q9zb3xfh3p1r4gz";
75+ };
76+
77+ dontUnpack = true;
78+
79+ nativeBuildInputs = [ unzip ];
80+
81+ installPhase = ''
82+ install -dm755 $out/Applications
83+ unzip $src -d $out/Applications
84+ '';
85+ };
86+in
87+if stdenv.isDarwin
88+then darwinPkg
89+else linuxPkg