An unofficial flake for an official Kotlin LSP server
1# The `kotlin-lsp` Flake
2
3This unofficial flake will help you enable [official Kotlin LSP](https://github.com/Kotlin/kotlin-lsp) in your devshell or NixOS configuration.
4
5To start, add `kotlin-lsp` to your flake input:
6
7```nix
8{
9 inputs.kotlin-lsp = {
10 inputs.nixpkgs.follows = "nixpkgs";
11 url = "git+https://tangled.org/bpavuk.neocities.org/kotlin-lsp-flake";
12 };
13...
14}
15```
16
17Then, add an overlay and `kotlin-lsp` dependency:
18
19```nix
20{
21 # inputs ...
22 # devshell boilerplate and existing code ...
23 let
24 pkgs = import nixpkgs {
25 overlays = [ kotlin-lsp.overlays.default ]
26 };
27 in
28 {
29 packages = [
30 # Gradle, JDK, Kotlin compiler itself, maybe other stuff ...
31
32 pkgs.kotlin-lsp
33 ];
34 };
35}
36```
37
38Now, try running `kotlin-lsp --help` in your command line to check if it all works.
39
40On attaching Kotlin LSP to other editors (Neovim, Zed, VS Code, etc.), take a look at [Kotlin LSP README](https://github.com/Kotlin/kotlin-lsp).
41
42Have fun!