!aRKdLCkUeIFjRPZuJT:nixos.org

NixOS JVM

108 Members
23 Servers

Load older messages


SenderMessageTime
23 May 2025
@raboof:matrix.orgraboofah ofc... neat trick though08:06:03
@qyliss:fairydust.spaceAlyssa RossIt 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:the-apothecary.clubAlicewe thought that java supports standard shebang syntax?08:14:06
@raboof:matrix.orgraboofit 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:matrix.orgmsgilliganI learned the trick from JBang, see https://www.jbang.dev/documentation/guide/latest/usage.html12:13:53
@msgilligan:matrix.orgmsgilliganJBang 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
@oscarvarto:matrix.orgOscar Vargas Torres joined the room.04:26:13
@deeok:matrix.org@deeok:matrix.org joined the room.16:46:44
1 Jun 2025
@seanthw:matrix.orgSean Thawe joined the room.23:38:12
2 Jun 2025
@frederic:scs.ems.hostFrédéric Christ changed their display name from Frédéric Christ (🧳 12.05. - 02.06.) to Frédéric Christ.07:02:38
@rdfg77:kde.orglinsui

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
@rdfg77:kde.orglinsuiIt seems it tries to resolve a subproject.09:31:34
4 Jun 2025
@etehtsea:matrix.orgkis-kis joined the room.17:02:22
@rob.sliwi:matrix.orgrobsliwi changed their display name from Robert Sliwinski to robsliwi.18:30:28
5 Jun 2025
@raboof:matrix.orgraboofnew easy(ish) way to get temurin-bin 25ea: https://codeberg.org/raboof/nix-jabba#readme15:42:51
@msgilligan:matrix.orgmsgilliganJava 25 is frozen: https://bsky.app/profile/nipafx.dev/post/3lqttwaggdk2216:05:09
@msgilligan:matrix.orgmsgilliganCan I use this from a flake?16:14:58
@raboof:matrix.orgraboof I think so, I don't see why not, but I haven't tried - if you've tried I'd love an example to include there ;) 16:24:44
@msgilligan:matrix.orgmsgilliganI have not tried. I've only used nix and flakes in situations where use via flakes is well-documented. i.e. I don't know how to wrap a non-flakes repo with a flake.16:26:57
@msgilligan:matrix.orgmsgilligan I'm also trying to figure out what the relationship is between nix-jabba and Jabba, which appears to be a Java version manager tool (but the main GitHub repo for Jabba seems unmaintained) 16:28:15
@oak:universumi.fioak 🏳️‍🌈♥️ joined the room.23:38:37
7 Jun 2025
@deeok:matrix.org@deeok:matrix.org changed their display name from deeok to matrixrooms.info mod bot (does NOT read/send messages and/or invites; used for checking reported rooms).23:44:37
@deeok:matrix.org@deeok:matrix.org left the room.23:56:24
9 Jun 2025
@sigmasquadron:matrix.orgSigmaSquadron joined the room.13:04:58
19 Jun 2025
@fliegendewurst:matrix.orgFliegendeWurst (@GPN23) changed their display name from FliegendeWurst to FliegendeWurst (@GPN23).12:29:30
22 Jun 2025
@ss:someonex.netSomeoneSerge (UTC+3) changed their display name from SomeoneSerge (UTC+U[-12,12]) to SomeoneSerge (Ever OOMed by Element).12:13:59
24 Jun 2025
@msgilligan:matrix.orgmsgilligan I just noticed that the zulu24 package is out of data and is still using 24.0.0. Is anyone interested in updating it to 24.0.1? 23:39:55
25 Jun 2025
@msgilligan:matrix.orgmsgilligan * I just noticed that the zulu24 package is still using 24.0.0. Is anyone interested in updating it to 24.0.1? 00:20:29
@msgilligan:matrix.orgmsgilligan(I'm willing to make a draft PR)00:21:59
@infinidoge:inx.moeInfinidoge 🏳️‍⚧️Surprised Zulu hasn't been given any auto updater yet03:39:14

Show newer messages


Back to Room ListRoom Version: 6