about summary refs log tree commit diff
path: root/pkgs/development/compilers/kotlin/native.nix
diff options
context:
space:
mode:
authorAndersonTorres <torres.anderson.85@protonmail.com>2021-10-24 00:12:35 -0300
committerAndersonTorres <torres.anderson.85@protonmail.com>2021-10-24 00:52:39 -0300
commit872080e31c44d8581d96e6260276203b44456e14 (patch)
treedf371b212887d193b49a6e8f06a455cfbbf9eaf1 /pkgs/development/compilers/kotlin/native.nix
parent1144ad9d02c810a4b8fd4b9156c4f7bd5b0cd49f (diff)
kotlin-native: init at 1.5.31
Diffstat (limited to 'pkgs/development/compilers/kotlin/native.nix')
-rw-r--r--pkgs/development/compilers/kotlin/native.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/pkgs/development/compilers/kotlin/native.nix b/pkgs/development/compilers/kotlin/native.nix
new file mode 100644
index 0000000000000..13c7143461d6c
--- /dev/null
+++ b/pkgs/development/compilers/kotlin/native.nix
@@ -0,0 +1,64 @@
+{ lib
+, stdenv
+, fetchurl
+, jre
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+  pname = "kotlin-native";
+  version = "1.5.31";
+
+  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" = "sha256-+9AF42AlPn1/8c14t8u+NN8FkoEmdt6tpmIKU9Rp2AM=";
+      "macos-x86_64" = "sha256-/eciSo4Eps2TTsv1XU1Rlm+KBmgQT0MWp2s/OAYtGt4=";
+      "linux-x86_64" = "sha256-Y2t+nlTu+j+h0oRneo7CJx0PmLAkqKYBJ+8go7rargM=";
+    }.${arch};
+  in
+    fetchurl {
+      url = getUrl version getArch;
+      hash = 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; [ ];
+    platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
+  };
+}