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