Conversation
|
Seems like somethings messed up with the foojay entry in the lockfile:
|
|
This foojay disco-api thing (found here) seems to be used to install a specific wanted version of openjdk21 automatically (I think specified here), which isn't something we want, we should probably just build with in-tree The following patch to your branch makes it work I think: use-temurin-instead.patchFrom 634671fcbc9201c724f51621376cdd4b465a8bdf Mon Sep 17 00:00:00 2001
From: Tom van Dijk <18gatenmaker6@gmail.com>
Date: Sun, 27 Apr 2025 15:50:46 +0200
Subject: [PATCH] pkl: use temurin-bin-21 instead
---
pkgs/by-name/pk/pkl/deps.json | 7 -------
pkgs/by-name/pk/pkl/package.nix | 10 +++++-----
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/pkgs/by-name/pk/pkl/deps.json b/pkgs/by-name/pk/pkl/deps.json
index a8c3ae6bdf85..af9adaa00978 100644
--- a/pkgs/by-name/pk/pkl/deps.json
+++ b/pkgs/by-name/pk/pkl/deps.json
@@ -1,13 +1,6 @@
{
"!comment": "This is a nixpkgs Gradle dependency lockfile. For more details, refer to the Gradle section in the nixpkgs manual.",
"!version": 1,
- "https://api.foojay.io": {
- "disco/v3": {
- "0/distributions": "sha256-Rp8uUFqKgDZZzFuikOVIsHVgg4+U3LLrecTM8E1E8+Q=",
- "0/ids/73bcfb608d1fde9fb62e462f834a3299/redirect": "sha256-b8sl8/caX/JF3sTr6L1cZD8XmlzQphwI5YqMZZFNL5c=",
- "0/packages": "sha256-AW0nLYHR4yQcJ9TIw6xdDIMUByoYUo+Vn+1YKMst0ec="
- }
- },
"https://plugins.gradle.org/m2": {
"com/github/johnrengelman#shadow/8.1.1": {
"jar": "sha256-CEGXVVWQpTuyG1lQijMwVZ9TbdtEjq/R7GdfVGIDb88=",
diff --git a/pkgs/by-name/pk/pkl/package.nix b/pkgs/by-name/pk/pkl/package.nix
index fc7c91474c3c..2605dfc56e7c 100644
--- a/pkgs/by-name/pk/pkl/package.nix
+++ b/pkgs/by-name/pk/pkl/package.nix
@@ -3,12 +3,12 @@
lib,
fetchFromGitHub,
gradle,
- jdk21,
+ temurin-bin-21,
kotlin,
nix-update-script,
}:
let
- jdk = jdk21;
+ jdk = temurin-bin-21;
gradleOverlay = gradle.override { java = jdk; };
kotlinOverlay = kotlin.override { jre = jdk; };
commitHash = "8bd738e";
@@ -43,8 +43,8 @@ stdenv.mkDerivation (finalAttrs: {
"-DreleaseBuild=true"
"-Dorg.gradle.java.home=${jdk}"
"-DcommitId=${commitHash}"
- "-Dorg.gradle.java.toolchains.autoProvision=false"
- "-Dorg.gradle.java.toolchains.auto-detect=false"
+ "-Porg.gradle.java.installations.auto-download=false"
+ "-Porg.gradle.java.installations.auto-detect=false"
];
JAVA_TOOL_OPTIONS = "-Dfile.encoding=utf-8";
@@ -61,7 +61,7 @@ stdenv.mkDerivation (finalAttrs: {
'';
passthru.updateScript = nix-update-script { };
-
+
meta = {
description = "A configuration as code language with rich validation and tooling.";
homepage = "https://pkl-lang.org";
--
2.49.0
Built on Note that this triggers a kotlinc and gradle rebuild, but those aren't from source so that cost almost no time. Also I manually removed that |
|
Thank you @dtomvan. I had forgotten to mention it failed to build |
|
#402115 just got merged into master, so |
|
I guess so |
|
dtomvan
left a comment
There was a problem hiding this comment.
Only nit I have. Happy to see pkl finally packaged 🎉
In the previous PR someone wanted a different path for "pkldoc" I think. Is that still needed?
|
Also, it could be nice to have support for a graalvm native build for its better performance compared to jpkl. Here's how @rafaelrc7 initially did it, might come in useful here: https://github.com/rafaelrc7/nixpkgs/blob/547687c5e341c9b0a9290bb277ef6cc81d1a3554/pkgs/by-name/pk/pkl/package.nix |
|
don't have that much time anymore to spend actually building on this PR. how big of an improvement are we talking here? |
|
That's alright, I'll give it a try tomorrow then. Just a suggestion anyways but I think I'd be helpful to nixos users (otherwise some people might say "pkl is always just slower on nix for no reason" for example) |
nyukuru
left a comment
There was a problem hiding this comment.
Please add the tests to the build, #286658 (comment) should still be useful.
|
@dtomvan good point. i can have a go and will see if it takes too much time i will update you |
|
Tried implementing tests but it fails and I do not have that much time left to spend on this PR. If anybody's willing to help me figure out why it fails it would be greatly appreciated |
|
Shouldn't this be wrapping java? When I build and try to run it I get |
|
Something must've slipped through. I have definitely checked that the $ nix-build -A pkl
[...]
$ file ./result/bin/pkl
./result/bin/pkl: data |
dtomvan
left a comment
There was a problem hiding this comment.
That file, albeit a weird format, seems to work when run with nix-shell -p temurin-bin-21 (which I accidentally must've done while reviewing), so maybe, instead of that sed command, which doesn't seems to work consistently, rather something like wrapProgram $out/bin/pkl --prefix PATH : "${lib.makeBinPath [ jdk ]}" should be used?
|
pushed your suggestion + dynamically getting the commit hash to feed to |
|
|
any kind souls willing to test on other platforms? |
|
The wrapper seems to be broken on Linux, I'm looking into a fix right now. |
|
By the way this can all be worked around when built as a native executable. That way it's also faster. The drv I made for that is here if you are interested in copying some parts of that. |
|
@dtomvan didnt you say last time you had trouble running the tests with that setup? |
|
You are right. We could just disable tests for the native build, but that kind-of defeats the point of all this effort to make the tests pass.... |
|
We'll see if @FliegendeWurst manages to fix the Linux build |
FliegendeWurst
left a comment
There was a problem hiding this comment.
With these changes the Linux build works
|
builds & runs on darwin |
|
unless anybody has something else to point out we should probably move forward with this pr |
FliegendeWurst
left a comment
There was a problem hiding this comment.
Works on Linux and Darwin
dtomvan
left a comment
There was a problem hiding this comment.
The following is probably redundant, but since I still have a "changes requested" next to my name, here you go:
nixpkgs-review result for #402086
Generated using nixpkgs-review-gha
Command: nixpkgs-review pr 402086
Logs: https://github.com/dtomvan/nixpkgs-review-gha/actions/runs/14777679232
x86_64-linux
✅ 1 package built:
- pkl
aarch64-linux
✅ 1 package built:
- pkl
x86_64-darwin (sandbox = false)
✅ 1 package built:
- pkl
aarch64-darwin (sandbox = false)
✅ 1 package built:
- pkl
|
Thanks a lot guys, really appreciate all the help. Great work |

Since #286658 was not moving, tried initiating a new PR
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.