{ lib, stdenv, unzip, fetchurl, electron, makeWrapper, geogebra }: let pname = "geogebra"; version = "6-0-723-0"; srcIcon = geogebra.srcIcon; desktopItem = geogebra.desktopItem; meta = with lib; geogebra.meta // { license = licenses.geogebra; maintainers = with maintainers; [ voidless sikmir ]; platforms = with platforms; linux ++ darwin; }; linuxPkg = stdenv.mkDerivation { inherit pname version meta; src = fetchurl { urls = [ "https://download.geogebra.org/installers/6.0/GeoGebra-Linux64-Portable-${version}.zip" "https://web.archive.org/web/20220807022226/https://download.geogebra.org/installers/6.0/GeoGebra-Linux64-Portable-${version}.zip" ]; sha256 = "f0b8a5bdadd3599489872ffe8e0bfd9e42ce3d28b1f6072001cc74f7d3e9e647"; }; dontConfigure = true; dontBuild = true; nativeBuildInputs = [ unzip makeWrapper ]; unpackPhase = '' unzip $src ''; installPhase = '' mkdir -p $out/libexec/geogebra/ $out/bin cp -r GeoGebra-linux-x64/{resources,locales} "$out/" makeWrapper ${lib.getBin electron}/bin/electron $out/bin/geogebra --add-flags "$out/resources/app" install -Dm644 "${desktopItem}/share/applications/"* \ -t $out/share/applications/ install -Dm644 "${srcIcon}" \ "$out/share/icons/hicolor/scalable/apps/geogebra.svg" ''; }; darwinPkg = stdenv.mkDerivation { inherit pname version; src = fetchurl { urls = [ "https://download.geogebra.org/installers/6.0/GeoGebra-Classic-6-MacOS-Portable-${version}.zip" "https://web.archive.org/web/20220807022337/https://download.geogebra.org/installers/6.0/GeoGebra-Classic-6-MacOS-Portable-${version}.zip" ]; sha256 = "463ca067c5187e0b639b72bef577b2f1bf73c394c9a1a88071c547e3e1c1888c"; }; dontUnpack = true; nativeBuildInputs = [ unzip ]; installPhase = '' install -dm755 $out/Applications unzip $src -d $out/Applications ''; meta = meta // { sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; }; }; in if stdenv.isDarwin then darwinPkg else linuxPkg