Conversation
dtomvan
left a comment
There was a problem hiding this comment.
Thank you for your first contribution, welcome to nixpkgs! I do however have some nitpicks, and then also a bug where graalvm-ce gets pulled into the derivation if nativeBuild == false.
|
|
Yup, same here. here are the logs for that failure |
|
Also, I saw someone upstream package it so that the
|
5f45769 to
655381a
Compare
pkgs/by-name/pk/pkl/package.nix
Outdated
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
I can confirm that this works! Could I include here on a separate commit or is it much preferred here to create separate PR? |
|
I think it could be fine in this PR |
|
I'm unable to build this now :( I'm not quite sure but does this mean nixpkgs' cc: @bioball |
There might also be value in using whatever GraalVM we use for the native step as the JDK we use for gradle/kotlinc, so |
|
One problem I found is that the current version of KGP they use in FWIW I can get it building with the following patch: default-openjdk-graalvm-23.patchdiff --git i/pkgs/by-name/pk/pkl/package.nix w/pkgs/by-name/pk/pkl/package.nix
index da54a38d7fad..12d08ba2d469 100644
--- i/pkgs/by-name/pk/pkl/package.nix
+++ w/pkgs/by-name/pk/pkl/package.nix
@@ -3,18 +3,21 @@
lib,
fetchFromGitHub,
gradle,
- temurin-bin-21,
kotlin,
nix-update-script,
replaceVars,
makeWrapper,
graalvmPackages,
+ openjdk,
buildNative ? true,
}:
let
- jdk = temurin-bin-21;
+ jdk = openjdk;
+ jdkMajorVersion = lib.versions.major jdk.version;
+ graalvmDir = graalvmPackages.graalvm-oracle_23;
gradleOverlay = gradle.override { java = jdk; };
kotlinOverlay = kotlin.override { jre = jdk; };
+
binaries = {
aarch64-darwin = "pkl-macos-aarch64";
aarch64-linux = "pkl-linux-aarch64";
@@ -54,14 +57,24 @@ stdenv.mkDerivation (finalAttrs: {
++ (
if nativeBuild then
[
- (replaceVars ./use_nix_graalvm_instead_of_download.patch {
- graalvmDir = graalvmPackages.graalvm-ce;
- })
+ (replaceVars ./use_nix_graalvm_instead_of_download.patch { inherit graalvmDir; })
]
else
[ ]
);
+ postPatch = ''
+ substituteInPlace buildSrc/build.gradle.kts \
+ --replace-fail "vendor = JvmVendorSpec.ADOPTIUM" "" \
+ --replace-fail "toolchainVersion = 21" "toolchainVersion = ${jdkMajorVersion}"
+
+ substituteInPlace buildSrc/src/main/kotlin/pklJavaLibrary.gradle.kts \
+ --replace-fail "vendor = info.jdkVendor" ""
+
+ substituteInPlace buildSrc/src/main/kotlin/BuildInfo.kt \
+ --replace-fail "vendor.set(jdkVendor)" ""
+ '';
+
nativeBuildInputs = [
gradleOverlay
jdk
|
Signed-off-by: Emmanuel Alap <15620712+ealap@users.noreply.github.com>
|
Any blocker for this PR? Shall I attract some committer to here via discourse? |
|
We still have these build failure on darwin which I don't understand, unfortunately. |
|
Looks like the error is happening when Truffle is trying to copy a native library onto the host machine. Try adding these CLI flags when calling into Might also be good to add |
Thanks @bioball! Unfortunately, it still fails on the same error message. I wonder it only happens on macos. |
|
It has to do with filesystem permissions; the build is trying to copy files into Looking at this PR, I'm not sure where |
Continuing the work from #286658 and #402086 by adding support for building native pkl. On my machine, native build is on average twice as fast as the jpkl build.
I don't know much about building Java applications so I just pieced everything from patches in previous PRs.
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.