20 snapshot = "2.2.1-SNAPSHOT";
21 pin = "2.2.1-20230117.075740-16";
24 snapshot = "1.1.0-SNAPSHOT";
25 pin = "1.1.0-20221226.155809-7";
29 stdenv.mkDerivation rec {
33 src = fetchFromGitHub {
37 hash = "sha256-Yj4mjXOZVM0dKcMfTjmnZs/kIs8AR0KJ9HKlyPM96j8=";
42 comment = meta.description;
44 desktopName = "JabRef";
45 genericName = "Bibliography manager";
46 categories = [ "Office" ];
49 startupWMClass = "org.jabref.gui.JabRefMain";
50 mimeTypes = [ "text/x-bibtex" ];
56 javafx-web = fetchurl {
57 url = "https://repo1.maven.org/maven2/org/openjfx/javafx-web/20/javafx-web-20.jar";
58 hash = "sha256-qRtVN34KURlVM5Ie/x25IfKsKsUcux7V2m3LML74G/s=";
62 pname = "${pname}-deps";
63 inherit src version postPatch;
65 nativeBuildInputs = [ gradle perl ];
67 export GRADLE_USER_HOME=$(mktemp -d)
68 gradle --no-daemon downloadDependencies -Dos.arch=amd64
69 gradle --no-daemon downloadDependencies -Dos.arch=aarch64
71 # 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)
73 find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
74 | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/''${\($5 =~ s/-jvm//r)}" #e' \
76 mv $out/org/jabref/afterburner.fx/${versionReplace.afterburner.pin} \
77 $out/org/jabref/afterburner.fx/${versionReplace.afterburner.snapshot}
78 mv $out/com/tobiasdiez/easybind/${versionReplace.easybind.pin} \
79 $out/com/tobiasdiez/easybind/${versionReplace.easybind.snapshot}
80 # This jar is required but not used or cached for unknown reason.
81 cp ${javafx-web} $out/org/openjfx/javafx-web/20/javafx-web-20.jar
83 # Don't move info to share/
84 forceShare = [ "dummy" ];
85 outputHashMode = "recursive";
86 outputHash = "sha256-XswHEKjzErL+znau/F6mTORVJlFSgVuT0svK29v5dEU=";
91 substituteInPlace build.gradle \
92 --replace 'org.jabref:afterburner.fx:${versionReplace.afterburner.snapshot}' \
93 'org.jabref:afterburner.fx:${versionReplace.afterburner.pin}' \
94 --replace 'com.tobiasdiez:easybind:${versionReplace.easybind.snapshot}' \
95 'com.tobiasdiez:easybind:${versionReplace.easybind.pin}'
97 # Disable update check
98 substituteInPlace src/main/java/org/jabref/preferences/JabRefPreferences.java \
99 --replace 'VERSION_CHECK_ENABLED, Boolean.TRUE' \
100 'VERSION_CHECK_ENABLED, Boolean.FALSE'
104 # Include CSL styles and locales in our build
105 cp -r buildres/csl/* src/main/resources/
107 # Use the local packages from -deps
108 sed -i -e '/repositories {/a maven { url uri("${deps}") }' \
110 buildSrc/build.gradle \
113 # The `plugin {}` block can't resolve plugins from the deps repo
114 sed -e '/plugins {/,/^}/d' buildSrc/build.gradle > buildSrc/build.gradle.tmp
115 cat > buildSrc/build.gradle <<EOF
117 repositories { maven { url uri("${deps}") } }
118 dependencies { classpath 'org.openjfx:javafx-plugin:0.0.14' }
121 apply plugin: 'org.openjfx.javafxplugin'
123 cat buildSrc/build.gradle.tmp >> buildSrc/build.gradle
126 nativeBuildInputs = [
142 export GRADLE_USER_HOME=$(mktemp -d)
146 -PprojVersion="${version}" \
147 -PprojVersionInfo="${version} NixOS" \
148 -Dorg.gradle.java.home=${jdk} \
154 dontWrapGApps = true;
159 install -dm755 $out/share/java/jabref
160 install -Dm644 LICENSE.md $out/share/licenses/jabref/LICENSE.md
161 install -Dm644 src/main/resources/icons/jabref.svg $out/share/pixmaps/jabref.svg
163 # script to support browser extensions
164 install -Dm755 buildres/linux/jabrefHost.py $out/lib/jabrefHost.py
165 patchShebangs $out/lib/jabrefHost.py
166 install -Dm644 buildres/linux/native-messaging-host/firefox/org.jabref.jabref.json $out/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
167 sed -i -e "s|/opt/jabref|$out|" $out/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
169 # Resources in the jar can't be found, workaround copied from AUR
170 cp -r build/resources $out/share/java/jabref
172 tar xf build/distributions/JabRef-${version}.tar -C $out --strip-components=1
174 # workaround for https://github.com/NixOS/nixpkgs/issues/162064
175 unzip $out/lib/javafx-web-*-*.jar libjfxwebkit.so -d $out/lib/
177 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')
185 # put this in postFixup because some gappsWrapperArgs are generated in gappsWrapperArgsHook in preFixup
186 makeWrapper ${jdk}/bin/java $out/bin/JabRef \
187 "''${gappsWrapperArgs[@]}" \
188 --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \
189 --add-flags "-Djava.library.path=$out/lib/ --patch-module org.jabref=$out/share/java/jabref/resources/main" \
190 --add-flags "$DEFAULT_JVM_OPTS"
192 # lowercase alias (for convenience and required for browser extensions)
193 ln -sf $out/bin/JabRef $out/bin/jabref
197 description = "Open source bibliography reference manager";
198 homepage = "https://www.jabref.org";
199 sourceProvenance = with sourceTypes; [
201 binaryBytecode # source bundles dependencies as jars
202 binaryNativeCode # source bundles dependencies as jars
204 license = licenses.mit;
205 platforms = [ "x86_64-linux" "aarch64-linux" ];
206 maintainers = with maintainers; [ gebner linsui ];