lol
1{ lib, stdenv, unzip, fetchurl, electron, makeWrapper, geogebra }:
2let
3 pname = "geogebra";
4 version = "6-0-794-0";
5
6 srcIcon = geogebra.srcIcon;
7 desktopItem = geogebra.desktopItem;
8
9 meta = with lib; {
10 description = "Dynamic mathematics software with graphics, algebra and spreadsheets";
11 longDescription = ''
12 Dynamic mathematics software for all levels of education that brings
13 together geometry, algebra, spreadsheets, graphing, statistics and
14 calculus in one easy-to-use package.
15 '';
16 homepage = "https://www.geogebra.org/";
17 maintainers = with maintainers; [ voidless sikmir ];
18 license = licenses.geogebra;
19 sourceProvenance = with sourceTypes; [
20 binaryBytecode
21 binaryNativeCode # some jars include native binaries
22 ];
23 platforms = with platforms; linux ++ darwin;
24 hydraPlatforms = [];
25 };
26
27 linuxPkg = stdenv.mkDerivation {
28 inherit pname version meta;
29
30 src = fetchurl {
31 urls = [
32 "https://download.geogebra.org/installers/6.0/GeoGebra-Linux64-Portable-${version}.zip"
33 "https://web.archive.org/web/20230824011801/https://download.geogebra.org/installers/6.0/GeoGebra-Linux64-Portable-${version}.zip"
34 ];
35 hash = "sha256-sNCq1Xcx/Y5r+SIRiqQYcG9dVsfIC2Ef5KJf+tgfxC8=";
36 };
37
38 dontConfigure = true;
39 dontBuild = true;
40
41 nativeBuildInputs = [
42 unzip
43 makeWrapper
44 ];
45
46 unpackPhase = ''
47 unzip $src
48 '';
49
50 installPhase = ''
51 mkdir -p $out/libexec/geogebra/ $out/bin
52 cp -r GeoGebra-linux-x64/{resources,locales} "$out/"
53 makeWrapper ${lib.getBin electron}/bin/electron $out/bin/geogebra --add-flags "$out/resources/app"
54 install -Dm644 "${desktopItem}/share/applications/"* \
55 -t $out/share/applications/
56
57 install -Dm644 "${srcIcon}" \
58 "$out/share/icons/hicolor/scalable/apps/geogebra.svg"
59 '';
60 };
61
62 darwinPkg = stdenv.mkDerivation {
63 inherit pname version;
64
65 src = fetchurl {
66 urls = [
67 "https://download.geogebra.org/installers/6.0/GeoGebra-Classic-6-MacOS-Portable-${version}.zip"
68 "https://web.archive.org/web/20230824012900/https://download.geogebra.org/installers/6.0/GeoGebra-Classic-6-MacOS-Portable-${version}.zip"
69 ];
70 hash = "sha256-CrSoKAjXiejfJHyv8wIpcRr2d8u/50HnatiDm1CdnGQ=";
71 };
72
73 dontUnpack = true;
74
75 nativeBuildInputs = [ unzip ];
76
77 installPhase = ''
78 install -dm755 $out/Applications
79 unzip $src -d $out/Applications
80 '';
81
82 meta = meta // {
83 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
84 };
85 };
86in
87if stdenv.isDarwin
88then darwinPkg
89else linuxPkg