at master 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 jre, 6 makeWrapper, 7}: 8 9stdenv.mkDerivation rec { 10 pname = "kotlin-native"; 11 version = "2.2.20"; 12 13 src = 14 let 15 getArch = 16 { 17 "aarch64-darwin" = "macos-aarch64"; 18 "x86_64-darwin" = "macos-x86_64"; 19 "x86_64-linux" = "linux-x86_64"; 20 } 21 .${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported."); 22 23 getUrl = 24 version: arch: 25 "https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-native-prebuilt-${arch}-${version}.tar.gz"; 26 27 getHash = 28 arch: 29 { 30 "macos-aarch64" = "sha256-UnDl9wj/7RXrEaApuAaLczIfz0lscQPf+pCeSdJxJeY="; 31 "macos-x86_64" = "sha256-mmsBQrx0yKqvvhnD8CU+oxqhWsOT1RzvzSniN3CeG7g="; 32 "linux-x86_64" = "sha256-2Ff+4rTj/W0tQBo6lADcQMIN4dAj32UnIXF9PRme0Nw="; 33 } 34 .${arch}; 35 in 36 fetchurl { 37 url = getUrl version getArch; 38 sha256 = getHash getArch; 39 }; 40 41 nativeBuildInputs = [ 42 jre 43 makeWrapper 44 ]; 45 46 installPhase = '' 47 runHook preInstall 48 49 mkdir -p $out 50 mv * $out 51 52 runHook postInstall 53 ''; 54 55 postFixup = '' 56 wrapProgram $out/bin/run_konan --prefix PATH ":" ${lib.makeBinPath [ jre ]} 57 ''; 58 59 meta = { 60 homepage = "https://kotlinlang.org/"; 61 description = "Modern programming language that makes developers happier"; 62 longDescription = '' 63 Kotlin/Native is a technology for compiling Kotlin code to native 64 binaries, which can run without a virtual machine. It is an LLVM based 65 backend for the Kotlin compiler and native implementation of the Kotlin 66 standard library. 67 ''; 68 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 69 license = lib.licenses.asl20; 70 maintainers = with lib.maintainers; [ fabianhjr ]; 71 platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin; 72 }; 73}