depot/third_party/nixpkgs/pkgs/development/compilers/kotlin/native.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

64 lines
1.7 KiB
Nix

{ lib
, stdenv
, fetchurl
, jre
, makeWrapper
}:
stdenv.mkDerivation rec {
pname = "kotlin-native";
version = "1.9.20";
src = let
getArch = {
"aarch64-darwin" = "macos-aarch64";
"x86_64-darwin" = "macos-x86_64";
"x86_64-linux" = "linux-x86_64";
}.${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported.");
getUrl = version: arch:
"https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-native-${arch}-${version}.tar.gz";
getHash = arch: {
"macos-aarch64" = "1pn371hy6hkyji4vkfiw3zw30wy0yyfhkxnkkyr8m0609945mkyj";
"macos-x86_64" = "13c28czvja93zaff0kzqf8crzh998l90gznq0cl6k2j3c0jhyrgm";
"linux-x86_64" = "sha256-faMuBYUG5qj0N4vg5EcfWIC3UjXiPhFJuikzXVgNsjw=";
}.${arch};
in
fetchurl {
url = getUrl version getArch;
sha256 = getHash getArch;
};
nativeBuildInputs = [
jre
makeWrapper
];
installPhase = ''
runHook preInstall
mkdir -p $out
mv * $out
runHook postInstall
'';
postFixup = ''
wrapProgram $out/bin/run_konan --prefix PATH ":" ${lib.makeBinPath [ jre ]}
'';
meta = {
homepage = "https://kotlinlang.org/";
description = "A modern programming language that makes developers happier";
longDescription = ''
Kotlin/Native is a technology for compiling Kotlin code to native
binaries, which can run without a virtual machine. It is an LLVM based
backend for the Kotlin compiler and native implementation of the Kotlin
standard library.
'';
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fabianhjr ];
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
};
}