NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.32k stars 13.56k forks source link

Package request: pkl #286104

Open nilsherzig opened 7 months ago

nilsherzig commented 7 months ago

Project description

Pkl — pronounced Pickle — is an embeddable configuration language which provides rich support for data templating and validation. It can be used from the command line, integrated in a build pipeline, or embedded in a program. Pkl scales from small to large, simple to complex, ad-hoc to repetitive configuration tasks.

Metadata

erikkrieg commented 7 months ago

I'm not a maintainer, but took a look at this out of curiosity. This project is written in Java/Kotlin and built with Gradle. I was messing around with a derivation to build it from source but hit a lot of walls with the gradle build. Made progress on several issues. Reached a point where it seems like Gradle expects JDK version 11 for some tasks, but then claims to need v17.0 for others? GraalVm is installed as one of the tasks and is configured to use v17.0, but since I set JAVA_HOME v17 might not be used by the correct task?

Honestly, since this is the first time I've looked at building Java software I don't know what I'm doing and have gone well past the amount of time I intended to look at this :P

Curious to see someone with actual Java build experience take a crack at it.

rafaelrc7 commented 7 months ago

Some comments when trying to package it. I did manage to easily build jpkl in a nix shell with:

nix shell nixpkgs#gradle_7 nixpkgs#jdk17
gradle build
./pkl-cli/build/executable/jpkl

What seems to indicate that it would not be hard to package it with the available nixpkgs packages.*

However, I was not so lucky with the native build, that I believe would be preferable. It depends on graalvm for jdk 11, while the currently available package in nixpkgs is graalvm for jdk 21. The project tries to download graalvm itself, however it is a dynamic linked binary and thus does not work in NixOS. I just removed the download function from the gradle settings, and used the nixpkgs package from 23.05. Like so:

nix shell nixpkgs#gradle_7 nixpkgs#jdk17 github:nixos/nixpkgs/23.05#graalvm11-ce
gradle nativeBuild
./pkl-cli/build/executable/pkl-linux-amd64

So it is easily buildable, but only if using packages from 23.05, that I believe would not be acceptable... More so because of the reason graalvm11-ce got removed: https://github.com/oracle/graal/issues/5063 . Its support got dropped.

*Now, back to the java version (jpkl). After confirming it was buildable, I tried to make a derivation, but apparently packaging gradle projects is not so straight-forward. I did try looking for examples, but did not got much forward...

rafaelrc7 commented 7 months ago

I created a draft PR (#286658) with my work in progress derivation. I advanced a lot. However it is still not building. Any help would be welcome.

rafaelrc7 commented 7 months ago

Sadly, I hit a roadblock I'm not being able to solve...

image

It fails to find a dependency. However, this dependency is being downloaded by the deps step. The issues seems that, for some reason, this pkl-cli subproject in gradle refuses to use the local repository and only its default, whatever it is. Thus, it never looks up in deps. I'm not sure how to fix it.

rafaelrc7 commented 1 month ago

The PR (#286658) is finally building and ready for review