15 stdenv.mkDerivation rec {
19 src = fetchFromGitHub {
23 hash = "sha256-wzBaAaxGsMPh64uW+bBOiycYfVCW9H5FCn06r6XdxeE=";
28 comment = meta.description;
30 desktopName = "JabRef";
31 genericName = "Bibliography manager";
32 categories = [ "Office" ];
35 startupWMClass = "org.jabref.gui.JabRefMain";
36 mimeTypes = [ "text/x-bibtex" ];
40 deps = stdenv.mkDerivation {
41 pname = "${pname}-deps";
44 nativeBuildInputs = [ gradle perl ];
46 export GRADLE_USER_HOME=$(mktemp -d)
47 gradle --no-daemon downloadDependencies
49 # perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
51 find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
52 | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/''${\($5 =~ s/-jvm//r)}" #e' \
55 # Don't move info to share/
56 forceShare = [ "dummy" ];
57 outputHashMode = "recursive";
59 x86_64-linux = "sha256-OicHJVFxHGPE76bEDoLhkEhVcAJmplqjoh2I3nnVaLA=";
60 aarch64-linux = "sha256-8QWmweptL/+pSO6DhfBLaLcBrfKd4TDsDoXs4TgXvew=";
61 }.${stdenv.hostPlatform.system} or (throw "Unsupported system ${stdenv.hostPlatform.system}");
65 # Include CSL styles and locales in our build
66 cp -r buildres/csl/* src/main/resources/
68 # Use the local packages from -deps
69 sed -i -e '/repositories {/a maven { url uri("${deps}") }' \
71 buildSrc/build.gradle \
83 buildInputs = [ gtk3 ];
88 export GRADLE_USER_HOME=$(mktemp -d)
92 -PprojVersion="${version}" \
93 -PprojVersionInfo="${version} NixOS" \
94 -Dorg.gradle.java.home=${jdk} \
100 dontWrapGApps = true;
105 install -dm755 $out/share/java/jabref
106 install -Dm644 LICENSE.md $out/share/licenses/jabref/LICENSE.md
107 install -Dm644 src/main/resources/icons/jabref.svg $out/share/pixmaps/jabref.svg
109 # script to support browser extensions
110 install -Dm755 buildres/linux/jabrefHost.py $out/lib/jabrefHost.py
111 install -Dm644 buildres/linux/native-messaging-host/firefox/org.jabref.jabref.json $out/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
112 sed -i -e "s|/opt/jabref|$out|" $out/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
114 # Resources in the jar can't be found, workaround copied from AUR
115 cp -r build/resources $out/share/java/jabref
117 # workaround for https://github.com/NixOS/nixpkgs/issues/162064
118 tar xf build/distributions/JabRef-${version}.tar -C $out --strip-components=1
119 unzip $out/lib/javafx-web-*-linux${lib.optionalString stdenv.isAarch64 "-aarch64"}.jar libjfxwebkit.so -d $out/lib/
121 DEFAULT_JVM_OPTS=$(sed -n -E "s/^DEFAULT_JVM_OPTS='(.*)'$/\1/p" $out/bin/JabRef | sed -e "s|\$APP_HOME|$out|g" -e 's/"//g')
124 makeWrapper ${jdk}/bin/java $out/bin/JabRef \
125 "''${gappsWrapperArgs[@]}" \
126 --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \
127 --add-flags "-Djava.library.path=$out/lib/ --patch-module org.jabref=$out/share/java/jabref/resources/main" \
128 --add-flags "$DEFAULT_JVM_OPTS"
130 # lowercase alias (for convenience and required for browser extensions)
131 ln -sf $out/bin/JabRef $out/bin/jabref
137 description = "Open source bibliography reference manager";
138 homepage = "https://www.jabref.org";
139 sourceProvenance = with sourceTypes; [
141 binaryBytecode # source bundles dependencies as jars
142 binaryNativeCode # source bundles dependencies as jars
144 license = licenses.gpl2;
145 platforms = [ "x86_64-linux" "aarch64-linux" ];
146 maintainers = with maintainers; [ gebner linsui ];