Files
nixpkgs/pkgs/by-name/pk/pkl/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

102 lines
2.2 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
gradle,
temurin-bin-21,
kotlin,
nix-update-script,
replaceVars,
makeWrapper,
}:
let
jdk = temurin-bin-21;
gradleOverlay = gradle.override { java = jdk; };
kotlinOverlay = kotlin.override { jre = jdk; };
in
stdenv.mkDerivation (finalAttrs: {
pname = "pkl";
version = "0.29.1";
src = fetchFromGitHub {
owner = "apple";
repo = "pkl";
tag = finalAttrs.version;
hash = "sha256-vel4Il/muHd4wqV5tfMPwBHoxgei8vPcnk2kS2/XG3I=";
leaveDotGit = true;
postFetch = ''
pushd $out
git rev-parse HEAD | tr -d '\n' > .commit-hash
rm -rf .git
popd
'';
};
patches = [
(replaceVars ./fix_kotlin_classpath.patch { gradle = gradle.unwrapped; })
./disable_gradle_codegen_tests.patch
./disable_bad_tests.patch
];
nativeBuildInputs = [
gradleOverlay
jdk
kotlinOverlay
makeWrapper
];
mitmCache = gradle.fetchDeps {
inherit (finalAttrs) pname;
data = ./deps.json;
};
doCheck = !(stdenv.hostPlatform.isDarwin);
gradleFlags = [
"-x"
"spotlessCheck"
"-DreleaseBuild=true"
"-Dorg.gradle.java.home=${jdk}"
"-Porg.gradle.java.installations.auto-download=false"
"-Porg.gradle.java.installations.auto-detect=false"
];
preBuild = ''
gradleFlagsArray+=(-DcommitId=$(cat .commit-hash))
'';
JAVA_TOOL_OPTIONS = "-Dfile.encoding=utf-8";
__darwinAllowLocalNetworking = true;
preCheck = ''
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/bin" "$out/opt/pkl"
cp ./pkl-cli/build/executable/jpkl "$out/opt/pkl/jpkl.jar"
makeWrapper ${lib.getExe jdk} $out/bin/pkl --add-flags "-jar $out/opt/pkl/jpkl.jar"
runHook postInstall
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Configuration-as-code language with rich validation and tooling";
homepage = "https://pkl-lang.org";
license = lib.licenses.asl20;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ hugolgst ];
mainProgram = "pkl";
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryBytecode # mitm cache
];
};
})