···11+{ lib
22+, fetchFromGitHub
33+, copyDesktopItems
44+, iconConvTools
55+, makeDesktopItem
66+, makeWrapper
77+, jdk11
88+, maven
99+}:
1010+1111+let
1212+ mvn = maven.override { jdk = jdk11; };
1313+in
1414+mvn.buildMavenPackage rec {
1515+ pname = "protege";
1616+ version = "5.6.4";
1717+1818+ src = fetchFromGitHub {
1919+ owner = "protegeproject";
2020+ repo = "protege";
2121+ rev = version;
2222+ hash = "sha256-Q3MHa7nCeF31n7JPltcemFBc/sJwGA9Ev0ymjQhY/U0=";
2323+ };
2424+2525+ mvnHash = "sha256-kemP2gDv1CYuaoK0fwzBxdLTusarPasf2jCDQj/HPYE=";
2626+2727+ patches = [
2828+ # Pin built-in Maven plugins to avoid checksum variations on Maven updates
2929+ ./enforce-plugin-versions.patch
3030+ # Avoid building platform-dependent builds which embed their own JREs
3131+ ./platform-independent-only.patch
3232+ ];
3333+3434+ nativeBuildInputs = [
3535+ copyDesktopItems
3636+ iconConvTools
3737+ jdk11
3838+ makeWrapper
3939+ ];
4040+4141+ installPhase = ''
4242+ runHook preInstall
4343+4444+ mkdir -p $out/bin $out/share/protege
4545+4646+ # Copy the application directory whole into the output, as it is used by the
4747+ # launcher script as a reference point to look for default configuration
4848+ mv protege-desktop/target/protege-${version}-platform-independent/Protege-${version} $out/Protege
4949+5050+ # Place a wrapper for the launcher script into a default /bin location
5151+ makeWrapper $out/Protege/run.sh $out/bin/protege \
5252+ --set JAVA_HOME ${jdk11.home}
5353+5454+ # Link all jars from within the standard /share/protege directory
5555+ ln -s -t $out/share/protege $out/Protege/bundles/*
5656+5757+ # Generate and copy icons to where they can be found
5858+ icoFileToHiColorTheme $out/Protege/app/Protege.ico protege $out
5959+6060+ runHook postInstall
6161+ '';
6262+6363+ desktopItems = [
6464+ (makeDesktopItem {
6565+ name = pname;
6666+ desktopName = "Protege Desktop";
6767+ genericName = "Ontology Editor";
6868+ icon = "protege";
6969+ comment = meta.description;
7070+ categories = [ "Development" ];
7171+ exec = "protege";
7272+ })
7373+ ];
7474+7575+ meta = {
7676+ homepage = "https://protege.stanford.edu/";
7777+ downloadPage = "https://protege.stanford.edu/software.php#desktop-protege";
7878+ description = "A free and open-source OWL 2 ontology editor";
7979+ longDescription = ''
8080+ Protégé Desktop is a feature rich ontology editing environment with full
8181+ support for the OWL 2 Web Ontology Language, and direct in-memory
8282+ connections to description logic reasoners.
8383+ '';
8484+ maintainers = with lib.maintainers; [ nessdoor ];
8585+ license = with lib.licenses; [ bsd2 ];
8686+ # TODO Protege is able to run on Darwin as well, but I (@nessdoor) had no
8787+ # way of testing it nor any experience in packaging Darwin apps, so I
8888+ # will leave the task to someone who has the right tools and knowledge.
8989+ platforms = lib.platforms.unix;
9090+ mainProgram = "protege";
9191+ sourceProvenance = with lib.sourceTypes; [ fromSource binaryBytecode ];
9292+ };
9393+}