home-assistant: support lightify component (#379007)
[NixPkgs.git] / pkgs / development / compilers / kotlin / native.nix
blob1de6ca3064f359eadd62d4a94a3c2cd26b32bc95
2   lib,
3   stdenv,
4   fetchurl,
5   jre,
6   makeWrapper,
7 }:
9 stdenv.mkDerivation rec {
10   pname = "kotlin-native";
11   version = "2.1.0";
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.");
23       getUrl =
24         version: arch:
25         "https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-native-prebuilt-${arch}-${version}.tar.gz";
27       getHash =
28         arch:
29         {
30           "macos-aarch64" = "sha256-FHXR5XA7B/fqox2GTIkCJ6BIaSKoufLY0yMLe2ZmoqM=";
31           "macos-x86_64" = "sha256-qXAnTdF9dkojOzb+vV08fZYYJUnQ43y8Yo0SxL6n2Ac=";
32           "linux-x86_64" = "sha256-5aAqD/ru6OGWitm+QGouXMNIc4xV8o4ltLWPc29t8P4=";
33         }
34         .${arch};
35     in
36     fetchurl {
37       url = getUrl version getArch;
38       sha256 = getHash getArch;
39     };
41   nativeBuildInputs = [
42     jre
43     makeWrapper
44   ];
46   installPhase = ''
47     runHook preInstall
49     mkdir -p $out
50     mv * $out
52     runHook postInstall
53   '';
55   postFixup = ''
56     wrapProgram $out/bin/run_konan --prefix PATH ":" ${lib.makeBinPath [ jre ]}
57   '';
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   };