nixpkgs/pkgs/development/compilers/kotlin/native.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.7 KiB
Nix
Raw Normal View History

2021-10-24 03:12:35 +00:00
{ lib
, stdenv
, fetchurl
, jre
, makeWrapper
}:
stdenv.mkDerivation rec {
pname = "kotlin-native";
2023-04-09 11:43:50 +00:00
version = "1.8.20";
2021-10-24 03:12:35 +00:00
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: {
2023-04-09 11:43:50 +00:00
"macos-aarch64" = "1lin4yd4wy56m4spkkd0glicphkwfr0gzvs66prm925fcx1hzk5y";
"macos-x86_64" = "0ma0d0kvpbqw8cx8ixmnhk96y5xz6ljy6phbzsl8cbmfp0g817p3";
"linux-x86_64" = "0f24ag9azzjgar3qg1fjh9q5haigj4k0yjpqxfrvjqj8khag5ls3";
2021-10-24 03:12:35 +00:00
}.${arch};
in
fetchurl {
url = getUrl version getArch;
2023-01-04 08:56:23 +00:00
sha256 = getHash getArch;
2021-10-24 03:12:35 +00:00
};
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 ];
2021-10-24 03:12:35 +00:00
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
};
}