An unofficial flake for an official Kotlin LSP server
The kotlin-lsp Flake#
This unofficial flake will help you enable official Kotlin LSP in your devshell or NixOS configuration.
To start, add kotlin-lsp to your flake input:
{
inputs.kotlin-lsp = {
inputs.nixpkgs.follows = "nixpkgs";
url = "git+https://tangled.org/bpavuk.neocities.org/kotlin-lsp-flake";
};
...
}
Then, add an overlay and kotlin-lsp dependency:
{
# inputs ...
# devshell boilerplate and existing code ...
let
pkgs = import nixpkgs {
overlays = [ kotlin-lsp.overlays.default ]
};
in
{
packages = [
# Gradle, JDK, Kotlin compiler itself, maybe other stuff ...
pkgs.kotlin-lsp
];
};
}
Now, try running kotlin-lsp --help in your command line to check if it all works.
On attaching Kotlin LSP to other editors (Neovim, Zed, VS Code, etc.), take a look at Kotlin LSP README.
Have fun!