depot/third_party/nixpkgs/pkgs/applications/science/math/geogebra/default.nix
Default email 13da32182d Project import generated by Copybara.
GitOrigin-RevId: a7855f2235a1876f97473a76151fec2afa02b287
2022-08-21 15:32:41 +02:00

96 lines
3 KiB
Nix

{ lib, stdenv, fetchurl, jre, makeDesktopItem, makeWrapper, unzip, language ? "en_US" }:
let
pname = "geogebra";
version = "5-0-723-0";
srcIcon = fetchurl {
url = "http://static.geogebra.org/images/geogebra-logo.svg";
sha256 = "01sy7ggfvck350hwv0cla9ynrvghvssqm3c59x4q5lwsxjsxdpjm";
};
desktopItem = makeDesktopItem {
name = "geogebra";
exec = "geogebra";
icon = "geogebra";
desktopName = "Geogebra";
genericName = "Geogebra";
comment = meta.description;
categories = [ "Education" "Science" "Math" ];
mimeTypes = [ "application/vnd.geogebra.file" "application/vnd.geogebra.tool" ];
};
meta = with lib; {
description = "Dynamic mathematics software with graphics, algebra and spreadsheets";
longDescription = ''
Dynamic mathematics software for all levels of education that brings
together geometry, algebra, spreadsheets, graphing, statistics and
calculus in one easy-to-use package.
'';
homepage = "https://www.geogebra.org/";
maintainers = with maintainers; [ sikmir imsofi ];
license = with licenses; [ gpl3 cc-by-nc-sa-30 geogebra ];
sourceProvenance = with sourceTypes; [
binaryBytecode
binaryNativeCode # some jars include native binaries
];
platforms = with platforms; linux ++ darwin;
hydraPlatforms = [];
};
linuxPkg = stdenv.mkDerivation {
inherit pname version meta srcIcon desktopItem;
preferLocalBuild = true;
src = fetchurl {
urls = [
"https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
"https://web.archive.org/web/20220807021654/https://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2"
];
sha256 = "fc05e2ae35b91f2d30650df08da0c20e060f559ef1fac1375cb70093c1d20507";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
install -D geogebra/* -t "$out/libexec/geogebra/"
makeWrapper "$out/libexec/geogebra/geogebra" "$out/bin/geogebra" \
--set JAVACMD "${jre}/bin/java" \
--set GG_PATH "$out/libexec/geogebra" \
--add-flags "--language=${language}"
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 meta;
preferLocalBuild = true;
src = fetchurl {
urls = [
"https://download.geogebra.org/installers/5.0/GeoGebra-MacOS-Installer-withJava-${version}.zip"
"https://web.archive.org/web/20220807021931/https://download.geogebra.org/installers/5.0/GeoGebra-MacOS-Installer-withJava-${version}.zip"
];
sha256 = "83aa702625c88be00ee005b40bdac0822af37dc1bba7dbf0ba6c4f547d7387d7";
};
dontUnpack = true;
nativeBuildInputs = [ unzip ];
installPhase = ''
install -dm755 $out/Applications
unzip $src -d $out/Applications
'';
};
in
if stdenv.isDarwin
then darwinPkg
else linuxPkg