!aRKdLCkUeIFjRPZuJT:nixos.org

NixOS JVM

120 Members
26 Servers

Load older messages


SenderMessageTime
14 Jul 2025
@emilazy:matrix.orgemily the path to our libGL will be patched in to the built binary automatically 16:40:44
@emilazy:matrix.orgemily(if you are building inside Nix)16:40:49
@emilazy:matrix.orgemily nix-ld is really only there for running awkward third-party binaries 16:41:01
@softmoonworld:matrix.org@softmoonworld:matrix.org

ahh thank you for that! hmm

16:41:42
@emilazy:matrix.orgemily if you're doing interactive development, then you should be able to just set LD_LIBRARY_PATH to include the path in your development shell hook 16:41:51
@softmoonworld:matrix.org@softmoonworld:matrix.org

i don't think i'm building inside of nix, i'm using the command line tools for running gradle inside of the project repository which i think is part of why it's not finding everything

16:42:55
@emilazy:matrix.orgemily e.g. export LD_LIBRARY_PATH=${addDriverRunpath.driverLink} 16:42:56
@softmoonworld:matrix.org@softmoonworld:matrix.org

ahh i see. okay! i'm going to do that. thanks!

16:43:32
@emilazy:matrix.orgemily $LD_LIBRARY_PATH will be used at runtime so it works inside a shell even with a binary that doesn't get the path patched in, and autoAddDriverRunpath would handle baking it in if you want a package built in Nix to install systemwide etc. 16:44:30
@msgilligan:matrix.orgmsgilliganThanks @emily. I've been using a hackier solution. Is this documented somewhere?16:45:19
@emilazy:matrix.orgemilyumm, good question :) if it is, I don't know about it because of the documentation16:46:05
@emilazy:matrix.orgemilythe answer is, uh, it's mentioned in passing in the documentation for CUDA maintenance!16:46:54
@emilazy:matrix.orgemilyand some release notes16:47:02
@emilazy:matrix.orgemilyit's usually only relevant for third-party binaries16:47:43
@emilazy:matrix.orgemily since "normal" software just links directly to libGL 16:47:49
@emilazy:matrix.orgemily but stuff doing dlopen at runtime needs LD_LIBRARY_PATH/runpath fixups 16:48:12
@emilazy:matrix.orgemily also, I said autoAddDriverRunpath but it probably wouldn't work for Java programs you're not building into a native executable with Graal or something because of course you just end up with a .jar and some shell scripts around it… 16:48:43
@emilazy:matrix.orgemily you would probably actually want to makeWrapper … --prefix LD_LIBRARY_PATH : ${addDriverRunpath.driverLink}/lib instead 16:49:22
@emilazy:matrix.orgemily also this is missing a /lib, sorry :) 16:49:27
@softmoonworld:matrix.org@softmoonworld:matrix.org

:)

16:49:55
@msgilligan:matrix.orgmsgilligan

because of course you just end up with a .jar and some shell scripts around it…

Well that's for making a Nix package or deploying, right? If softmoonworld is (perhaps initially) only interested in development, there should be a way to add it via Gradle. My hacky solution added the library via nix profile install, thus:

test {
        useJUnitPlatform()
        def userHome = System.getProperty("user.home")
        systemProperty "java.library.path", findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"
    }
16:55:32
@msgilligan:matrix.orgmsgilligan *

because of course you just end up with a .jar and some shell scripts around it…

Well that's for making a Nix package or deploying, right? If softmoonworld is (perhaps initially) only interested in development, there should be a way to add it via Gradle. My hacky solution added the library via nix profile install, thus:

test {
        useJUnitPlatform()
        def userHome = System.getProperty("user.home")
        systemProperty "java.library.path", findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"
}
16:55:59
@msgilligan:matrix.orgmsgilligan

My hacky GitLab CI build is like this:

# Build on NixOS using the devshell from `flake.nix` and secp256k1 installed via `nix profile install`
nixos-devshell:
  image: nixos/nix:latest
  variables:
    NIXPKGS_URL: "github:NixOS/nixpkgs/nixos-unstable"
  before_script:
    # Configure Nix to use a binary cache and enable experimental features
    - nix-env -iA nixpkgs.cachix
    - cachix use nix-community
    - echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
    - nix profile install nixpkgs#secp256k1
  script:
    - nix develop .#minimum -c gradle build run runEcdsa
  cache:
    key: "${CI_COMMIT_REF_SLUG}"
    paths:
      - /nix/store
      - ~/.gradle/
16:59:09
@msgilligan:matrix.orgmsgilligan So I'm hoping autoAddDriverRunpath might allow me to get rid of the nix profile install 16:59:45
@msgilligan:matrix.orgmsgilligan (I'm also working on a Nix sandbox build using mitmCache = gradle.fetchDeps, etc. But that's not finished yet) 17:02:45
@msgilligan:matrix.orgmsgilligan(I'm using Java FFM ("Panama") to access the native library, so that's why I'm so interested in getting JDK 25 and GraalVM 25 support -- because that's the first LTS release of FFM.)17:05:10
@msgilligan:matrix.orgmsgilliganBTW, Is anyone on this list planning on going to DEFCON/Nix Vegas?17:06:30
@msgilligan:matrix.orgmsgilliganIt would be great to have some kind of a JDK BoF/meetup/talk…17:32:06
@msgilligan:matrix.orgmsgilligan

I posted two comments on Issue #313216: Tracking Improve JDK infrastructure:

The dashboard module would be a good learning experience for me, so if I get halfway-positive feedback I'll probably attempt something. And I'd love to have a mentor or two to give me advice on it.

18:57:18
15 Jul 2025
@softmoonworld:matrix.org@softmoonworld:matrix.org changed their display name from softmoonworld to moon.00:03:44

Show newer messages


Back to Room ListRoom Version: 6