···1+{ lib
2+, fetchFromGitHub
3+, copyDesktopItems
4+, iconConvTools
5+, makeDesktopItem
6+, makeWrapper
7+, jdk11
8+, maven
9+}:
10+11+let
12+ mvn = maven.override { jdk = jdk11; };
13+in
14+mvn.buildMavenPackage rec {
15+ pname = "protege";
16+ version = "5.6.4";
17+18+ src = fetchFromGitHub {
19+ owner = "protegeproject";
20+ repo = "protege";
21+ rev = version;
22+ hash = "sha256-Q3MHa7nCeF31n7JPltcemFBc/sJwGA9Ev0ymjQhY/U0=";
23+ };
24+25+ mvnHash = "sha256-kemP2gDv1CYuaoK0fwzBxdLTusarPasf2jCDQj/HPYE=";
26+27+ patches = [
28+ # Pin built-in Maven plugins to avoid checksum variations on Maven updates
29+ ./enforce-plugin-versions.patch
30+ # Avoid building platform-dependent builds which embed their own JREs
31+ ./platform-independent-only.patch
32+ ];
33+34+ nativeBuildInputs = [
35+ copyDesktopItems
36+ iconConvTools
37+ jdk11
38+ makeWrapper
39+ ];
40+41+ installPhase = ''
42+ runHook preInstall
43+44+ mkdir -p $out/bin $out/share/protege
45+46+ # Copy the application directory whole into the output, as it is used by the
47+ # launcher script as a reference point to look for default configuration
48+ mv protege-desktop/target/protege-${version}-platform-independent/Protege-${version} $out/Protege
49+50+ # Place a wrapper for the launcher script into a default /bin location
51+ makeWrapper $out/Protege/run.sh $out/bin/protege \
52+ --set JAVA_HOME ${jdk11.home}
53+54+ # Link all jars from within the standard /share/protege directory
55+ ln -s -t $out/share/protege $out/Protege/bundles/*
56+57+ # Generate and copy icons to where they can be found
58+ icoFileToHiColorTheme $out/Protege/app/Protege.ico protege $out
59+60+ runHook postInstall
61+ '';
62+63+ desktopItems = [
64+ (makeDesktopItem {
65+ name = pname;
66+ desktopName = "Protege Desktop";
67+ genericName = "Ontology Editor";
68+ icon = "protege";
69+ comment = meta.description;
70+ categories = [ "Development" ];
71+ exec = "protege";
72+ })
73+ ];
74+75+ meta = {
76+ homepage = "https://protege.stanford.edu/";
77+ downloadPage = "https://protege.stanford.edu/software.php#desktop-protege";
78+ description = "A free and open-source OWL 2 ontology editor";
79+ longDescription = ''
80+ Protégé Desktop is a feature rich ontology editing environment with full
81+ support for the OWL 2 Web Ontology Language, and direct in-memory
82+ connections to description logic reasoners.
83+ '';
84+ maintainers = with lib.maintainers; [ nessdoor ];
85+ license = with lib.licenses; [ bsd2 ];
86+ # TODO Protege is able to run on Darwin as well, but I (@nessdoor) had no
87+ # way of testing it nor any experience in packaging Darwin apps, so I
88+ # will leave the task to someone who has the right tools and knowledge.
89+ platforms = lib.platforms.unix;
90+ mainProgram = "protege";
91+ sourceProvenance = with lib.sourceTypes; [ fromSource binaryBytecode ];
92+ };
93+}