An unofficial flake for an official Kotlin LSP server

init: packaged Kotlin LSP

Changed files
+155
+61
flake.lock
··· 1 + { 2 + "nodes": { 3 + "flake-parts": { 4 + "inputs": { 5 + "nixpkgs-lib": "nixpkgs-lib" 6 + }, 7 + "locked": { 8 + "lastModified": 1763759067, 9 + "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", 10 + "owner": "hercules-ci", 11 + "repo": "flake-parts", 12 + "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", 13 + "type": "github" 14 + }, 15 + "original": { 16 + "owner": "hercules-ci", 17 + "repo": "flake-parts", 18 + "type": "github" 19 + } 20 + }, 21 + "nixpkgs": { 22 + "locked": { 23 + "lastModified": 1765186076, 24 + "narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=", 25 + "owner": "nixos", 26 + "repo": "nixpkgs", 27 + "rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8", 28 + "type": "github" 29 + }, 30 + "original": { 31 + "owner": "nixos", 32 + "ref": "nixos-unstable", 33 + "repo": "nixpkgs", 34 + "type": "github" 35 + } 36 + }, 37 + "nixpkgs-lib": { 38 + "locked": { 39 + "lastModified": 1761765539, 40 + "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", 41 + "owner": "nix-community", 42 + "repo": "nixpkgs.lib", 43 + "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc", 44 + "type": "github" 45 + }, 46 + "original": { 47 + "owner": "nix-community", 48 + "repo": "nixpkgs.lib", 49 + "type": "github" 50 + } 51 + }, 52 + "root": { 53 + "inputs": { 54 + "flake-parts": "flake-parts", 55 + "nixpkgs": "nixpkgs" 56 + } 57 + } 58 + }, 59 + "root": "root", 60 + "version": 7 61 + }
+94
flake.nix
··· 1 + { 2 + description = "An unofficial Nix wrapper for official Kotlin LSP"; 3 + 4 + inputs = { 5 + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 6 + flake-parts.url = "github:hercules-ci/flake-parts"; 7 + }; 8 + 9 + outputs = inputs@{ self, nixpkgs, flake-parts, ... }: 10 + flake-parts.lib.mkFlake { inherit inputs; } { 11 + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; 12 + 13 + perSystem = { config, self', inputs', pkgs, system, ... }: 14 + let 15 + sources = { 16 + "x86_64-linux" = { 17 + url = "https://download-cdn.jetbrains.com/kotlin-lsp/261.13587.0/kotlin-lsp-261.13587.0-linux-x64.zip"; 18 + hash = "sha256-EweSqy30NJuxvlJup78O+e+JOkzvUdb6DshqAy1j9jE="; 19 + }; 20 + "aarch64-linux" = { 21 + url = "https://download-cdn.jetbrains.com/kotlin-lsp/261.13587.0/kotlin-lsp-261.13587.0-linux-aarch64.zip"; 22 + hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; 23 + }; 24 + "x86_64-darwin" = { 25 + url = "https://download-cdn.jetbrains.com/kotlin-lsp/261.13587.0/kotlin-lsp-261.13587.0-mac-x64.zip"; 26 + hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; 27 + }; 28 + "aarch64-darwin" = { 29 + url = "https://download-cdn.jetbrains.com/kotlin-lsp/261.13587.0/kotlin-lsp-261.13587.0-mac-aarch64.zip"; 30 + hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; 31 + }; 32 + }; 33 + 34 + srcData = sources.${system} or (throw "Unsupported system: ${system}"); 35 + in 36 + { 37 + formatter = pkgs.nixpkgs-fmt; 38 + 39 + packages.default = pkgs.stdenv.mkDerivation { 40 + pname = "kotlin-lsp"; 41 + version = "261.13587.0"; 42 + 43 + src = pkgs.fetchzip { 44 + url = srcData.url; 45 + hash = srcData.hash; 46 + stripRoot = false; 47 + }; 48 + 49 + nativeBuildInputs = [ 50 + pkgs.makeWrapper 51 + ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ 52 + pkgs.autoPatchelfHook 53 + ]; 54 + 55 + buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ 56 + pkgs.stdenv.cc.cc.lib 57 + pkgs.zlib 58 + pkgs.libxtst 59 + pkgs.alsa-lib 60 + pkgs.freetype 61 + pkgs.wayland 62 + pkgs.libxrender 63 + ]; 64 + 65 + installPhase = '' 66 + runHook preInstall 67 + 68 + mkdir -p $out/bin $out/libexec 69 + cp -r ./* $out/libexec 70 + chmod -R u+w $out/libexec 71 + chmod +x $out/libexec/kotlin-lsp.sh 72 + chmod +x $out/libexec/jre/bin/java 73 + patchShebangs $out/libexec/kotlin-lsp.sh 74 + makeWrapper $out/libexec/kotlin-lsp.sh $out/bin/kotlin-lsp 75 + 76 + runHook postInstall 77 + ''; 78 + 79 + meta = { 80 + description = "Kotlin Language Server by JetBrains"; 81 + homepage = "https://github.com/Kotlin/kotlin-lsp"; 82 + license = pkgs.lib.licenses.asl20; 83 + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; 84 + }; 85 + }; 86 + }; 87 + 88 + flake = { 89 + overlays.default = final: prev: { 90 + kotlin-lsp = self.packages.${prev.system}.default; 91 + }; 92 + }; 93 + }; 94 + }