| 16 May 2025 |
emily | though of course a binary build is less of a burden than a source one | 20:26:19 |
| 17 May 2025 |
| terrorjack set a profile picture. | 08:53:54 |
| 21 May 2025 |
msgilligan | I'm ready to begin experimenting with JDK 25 and a Temurin EA binary build would be helpful. Since JDK 25 will be LTS and will be final in September, getting packages migrated to JDK 25 earlier will help get more ported in time for the Nix 25.11 release.
(Projects using Gradle have a tougher time since Gradle is usually the critical path to upgrading to a new JDK. I'm considering migrating one project to Maven mainly for this reason.)
As others have mentioned, things like EA releases could also be provided in a repo other than Nixpkgs.
| 22:16:38 |
| 22 May 2025 |
raboof | I agree the ideal solution would be to allow getting 'unusual' JVMs (such as EA ones) though packages outside of nixpkgs. Sadly the nix packaging for a JVM seems nontrivial and currently not easily reusable outside of nixpkgs, which is how I ended up proposing https://github.com/NixOS/nixpkgs/pull/368598 for now. | 09:47:50 |
raboof | (I used to have something based on https://github.com/shyiko/jabba but that seems no longer active) | 09:51:09 |
raboof | might be worth revisiting seeing if we could plug the output of https://github.com/NixOS/nixpkgs/pull/368598/files#diff-f8aad332f02513cf4d092cf685ff2e8f43a9c09787a7212a8021c223bd6dc9e7 into https://codeberg.org/raboof/nix-jabba actually... realistically I won't have time for that for the next few weeks but if someone wants to give it a shot go for it ;) | 09:53:07 |
msgilligan | Well, the ideal solution would be to have them in Nixpkgs and to have the necessary developers to maintain them.
I really wish I had more time and more Nix knowledge. My Nix knowledge is growing though unfortunately my available time isn't. But I think #368598 is important and am willing to help test it.
(I use SDKMAN! and it is very useful when you are testing with a wide variety of JDKs, gradles, mavens. etc. At some point it might be nice to be able to install SDKMAN! with Nix.)
Maybe the best thing to do is create a JDK-focused fork of Nixpkgs with an integration branch. This would allow us to do more testing and integration prior to submission (and acceptance) by Nixpkgs.
| 17:33:38 |
msgilligan | Note that I've previously talked about the challenges I've faced using Nixpkgs for "cutting-edge" JDK development. In particular the way one non-LTS JDK (e.g. 23) will disappear and new one (e.g. 24) will replace it in the same commit makes things challenging. Having access to EAs of new JDKs solves my problem in a more proactive way, by allowing developers to get ahead of the change by testing with the new JDK version sooner.
The JDK 25 release will likely end my critical dependence on non-LTS JDKs, so the sooner we get there the better. If I focus on 25, it will help me and Nixpkgs get there sooner. | 17:40:38 |
msgilligan | BTW, JDK 25 version 25-ea+23, has the long-awaited JEP 512: Compact Source Files and Instance Main Methods implemented, so hello.java in the following format is both a valid Java program and a runnable script:
///usr/bin/env java "$0" "$@" ; exit $?
void main() {
IO.println("Hello, World!");
}
| 17:44:15 |
msgilligan | My reason for being dependent on these recent JDKs is the Foreign Function and Memory API introduced in Java 22. | 17:51:30 |
| @qbig:matrix.org joined the room. | 19:22:27 |
| @qbig:matrix.org left the room. | 19:44:42 |
| 23 May 2025 |
raboof | whoa is that // a sort of alternative shebang? what's that called? TIL | 08:00:34 |
Alyssa Ross | I think it's relying on being run by a shell | 08:04:08 |
Alyssa Ross | And then it's just an absolute path | 08:04:15 |
Alyssa Ross | i.e. execve wouldn't work, but shells usually fall back to executing as a shell script and that would work. | 08:05:06 |
raboof | ah ofc... neat trick though | 08:06:03 |
Alyssa Ross | It also takes advantage of shells executing line by line, so it can just tell the shell to exit before encountering the Java code that would be a syntax error. | 08:09:03 |
Alice | we thought that java supports standard shebang syntax? | 08:14:06 |
raboof | it does, but that doesn't seem to work together (yet?) it seems (gives "error: no class declared in source file" when the shebang exists) | 08:49:14 |
msgilligan | I learned the trick from JBang, see https://www.jbang.dev/documentation/guide/latest/usage.html | 12:13:53 |
msgilligan | JBang is available in Nixpkgs and is worth checking out. (I may send them a PR to their documentation to add Nix as an installation method) | 12:15:49 |
| 29 May 2025 |
| Oscar Vargas Torres joined the room. | 04:26:13 |
| @deeok:matrix.org joined the room. | 16:46:44 |
| 1 Jun 2025 |
| Sean Thawe joined the room. | 23:38:12 |
| 2 Jun 2025 |
| Frédéric Christ changed their display name from Frédéric Christ (🧳 12.05. - 02.06.) to Frédéric Christ. | 07:02:38 |
linsui | I'm trying to update jabref to latest master and fetchDeps fails.
{
lib,
stdenv,
fetchurl,
fetchFromGitHub,
wrapGAppsHook3,
makeDesktopItem,
copyDesktopItems,
unzip,
zip,
xdg-utils,
gtk3,
jdk24,
openjfx24,
gradle,
python3,
postgresql,
}:
let
jdk = jdk24;
ltwaUrl = "https://www.issn.org/wp-content/uploads/2021/07/ltwa_20210702.csv";
ltwa = fetchurl {
url = ltwaUrl;
hash = "sha256-jnS8Y9x8eg2L3L3RPnS6INTs19mEtwzfNIjJUw6HtIY=";
};
in
stdenv.mkDerivation rec {
version = "6.0-alpha2";
pname = "jabref";
src = fetchFromGitHub {
owner = "JabRef";
repo = "jabref";
rev = "4f1b9fc15e1c893abe6b93dba84162eef32ee3b1";
hash = "sha256-qiVOFp7bcF1FP8bDEEhYDRmTnUC7qLqZE3RNqBKCzec=";
fetchSubmodules = true;
};
desktopItems = [
(makeDesktopItem {
comment = meta.description;
name = "JabRef";
desktopName = "JabRef";
genericName = "Bibliography manager";
categories = [ "Office" ];
icon = "jabref";
exec = "JabRef %U";
startupWMClass = "org.jabref.gui.JabRefGUI";
mimeTypes = [ "text/x-bibtex" ];
})
];
mitmCache = gradle.fetchDeps {
inherit pname;
data = ./deps.json;
};
postPatch = ''
sed -i -e '/vendor/d' build-logic/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts
pushd jablib
# Disable update check
substituteInPlace src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java \
--replace-fail 'VERSION_CHECK_ENABLED, Boolean.TRUE' \
'VERSION_CHECK_ENABLED, Boolean.FALSE'
# Find OpenOffice/LibreOffice binary
substituteInPlace src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java \
--replace-fail '/usr' '/run/current-system/sw'
sed -i -e '/setOutputRedirector/d' src/main/java/org/jabref/logic/search/PostgreServer.java
substituteInPlace build.gradle.kts src/main/java/org/jabref/generators/LtwaListMvGenerator.java \
--replace-fail '${ltwaUrl}' 'file://${ltwa}'
popd
'';
nativeBuildInputs = [
jdk
gradle
wrapGAppsHook3
copyDesktopItems
unzip
zip
];
buildInputs = [
gtk3
python3
];
gradleFlags = [
"-PprojVersion=${version}"
"-Dorg.gradle.java.home=${jdk}"
];
preBuild = ''
gradleFlagsArray+=(-PprojVersionInfo="${version} NixOS")
'';
dontWrapGApps = true;
installPhase = ''
runHook preInstall
install -dm755 $out/share/java/jabref
install -Dm644 LICENSE $out/share/licenses/jabref/LICENSE
install -Dm644 src/main/resources/icons/jabref.svg $out/share/pixmaps/jabref.svg
# script to support browser extensions
install -Dm755 jabgui/buildres/linux/jabrefHost.py $out/lib/jabrefHost.py
patchShebangs $out/lib/jabrefHost.py
install -Dm644 jabgui/buildres/mac/Resources/native-messaging-host/firefox/org.jabref.jabref.json $out/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
sed -i -e "s|/opt/jabref|$out|" $out/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
# Resources in the jar can't be found, workaround copied from AUR
cp -r build/resources $out/share/java/jabref
tar xf build/distributions/JabRef-${version}.tar -C $out --strip-components=1
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')
# Temp fix: openjfx doesn't build with webkit
unzip $out/lib/javafx-web-*-*.jar libjfxwebkit.so -d $out/lib/
# Use postgresql from nixpkgs since the bundled binary doesn't work on NixOS
rm $out/lib/embedded-postgres-binaries-*.jar
PG_VER=$(sed -n -E "s/.*embedded-postgres-binaries-bom:(.*)'/\1/p" build.gradle)
ARCH1=${if stdenv.isAarch64 then "arm64v8" else "amd64"}
ARCH2=${if stdenv.isAarch64 then "arm_64" else "x86_64"}
mkdir postgresql
cd postgresql
ln -s ${postgresql}/{lib,share} ./
mkdir -p bin
ln -s ${postgresql}/bin/{postgres,initdb} ./bin
# Wrap pg_ctl to workaround https://github.com/NixOS/nixpkgs/issues/83770
# Use custom wrap to workaround https://github.com/NixOS/nixpkgs/issues/330471
echo -e '#!/usr/bin/env bash\n${postgresql}/bin/pg_ctl "-o \"-k /tmp\"" "$@"' > ./bin/pg_ctl
chmod +x ./bin/pg_ctl
tar -cJf postgres-linux-$ARCH2.txz *
zip embedded-postgres-binaries-linux-$ARCH1-$PG_VER.jar postgres-linux-$ARCH2.txz
cd ..
mv postgresql/embedded-postgres-binaries-linux-$ARCH1-$PG_VER.jar $out/lib
runHook postInstall
'';
postFixup = ''
rm $out/bin/*
# put this in postFixup because some gappsWrapperArgs are generated in gappsWrapperArgsHook in preFixup
makeWrapper ${jdk}/bin/java $out/bin/JabRef \
"''${gappsWrapperArgs[@]}" \
--suffix PATH : ${
lib.makeBinPath [
xdg-utils
postgresql
]
} \
--add-flags "-Djava.library.path=$out/lib/ --patch-module org.jabref=$out/share/java/jabref/resources/main" \
--add-flags "$DEFAULT_JVM_OPTS"
# lowercase alias (for convenience and required for browser extensions)
ln -sf $out/bin/JabRef $out/bin/jabref
'';
gradleUpdateScript = ''
runHook preBuild
gradle nixDownloadDeps -Dos.arch=amd64
gradle nixDownloadDeps -Dos.arch=aarch64
'';
meta = with lib; {
description = "Open source bibliography reference manager";
homepage = "https://www.jabref.org";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # source bundles dependencies as jars
binaryNativeCode # source bundles dependencies as jars
];
license = licenses.mit;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
maintainers = with maintainers; [
linsui
];
};
}
it fails with
> Task :nixDownloadDeps
> Task :jabgui:nixDownloadDeps
> Task :jabgui:nixDownloadDeps FAILED
[Incubating] Problems report is available at: file:///tmp/nix-shell-2-0/tmp.Mcq03htTrt/source/build/reports/problems/problems-report.html
FAILURE: Build failed with an exception.
* Where:
Initialization script '/nix/store/wdw15x3256w3gv7jkjmaz211q3344xvc-init-deps.gradle' line: 5
* What went wrong:
Execution failed for task ':jabgui:nixDownloadDeps'.
> Could not resolve all files for configuration ':jabgui:compileClasspath'.
> Failed to transform jablib.jar (project :jablib) to match attributes {artifactType=jar, javaModule=true, org.gradle.category=library, org.gradle.depend
ency.bundling=external, org.gradle.jvm.version=24, org.gradle.libraryelements=jar, org.gradle.usage=java-api}.
> Execution failed for ExtraJavaModuleInfoTransform: /tmp/nix-shell-2-0/tmp.Mcq03htTrt/source/jablib/build/libs/jablib.jar.
> File does not exist: /tmp/nix-shell-2-0/tmp.Mcq03htTrt/source/jablib/build/libs/jablib.jar
This is likely because a tool or another plugin performs early dependency resolution.
You can prevent this error by setting 'skipLocalJars = true'.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.14.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation
.
BUILD FAILED in 8m 14s
11 actionable tasks: 11 executed
| 09:30:50 |
linsui | It seems it tries to resolve a subproject. | 09:31:34 |
| 4 Jun 2025 |
| @etehtsea:matrix.org joined the room. | 17:02:22 |
| robsliwi changed their display name from Robert Sliwinski to robsliwi. | 18:30:28 |