Skip to content

kotlin-lsp: init at 0.253.10629 - #435169

Closed
p-louis wants to merge 2 commits into
NixOS:masterfrom
p-louis:add-kotlin-lsp-package
Closed

p-louis wants to merge 2 commits into
NixOS:masterfrom
p-louis:add-kotlin-lsp-package

Conversation

@p-louis

@p-louis p-louis commented Aug 20, 2025

Copy link
Copy Markdown

This PR adds the kotlin-lsp package in the latest available version at the time of writing this.

Considering this is the official LSP implementation it will supersede kotlin-language-server in the long run.

Release notes:
https://github.com/Kotlin/kotlin-lsp/releases/tag/kotlin-lsp%2Fv0.253.10629

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

Considering this is the official LSP implementation it will supersede
`kotlin-language-server` in the long run.

Release notes:
https://github.com/Kotlin/kotlin-lsp/releases/tag/kotlin-lsp%2Fv0.253.10629
@nixpkgs-ci nixpkgs-ci Bot added the 12.first-time contribution This PR is the author's first one; please be gentle! label Aug 20, 2025
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Aug 20, 2025
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
@p-louis
p-louis force-pushed the add-kotlin-lsp-package branch from f651ecc to 873c9d4 Compare August 20, 2025 05:11
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
@p-louis
p-louis force-pushed the add-kotlin-lsp-package branch from 873c9d4 to f53a7bd Compare August 20, 2025 05:14
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
@ofborg ofborg Bot added the ofborg-internal-error Ofborg encountered an error label Aug 27, 2025
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
@ofborg ofborg Bot removed the ofborg-internal-error Ofborg encountered an error label Dec 18, 2025
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. labels Dec 18, 2025
@p-louis
p-louis force-pushed the add-kotlin-lsp-package branch from a1ecc4f to 604ab55 Compare December 18, 2025 08:37
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix Outdated
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
@p-louis
p-louis force-pushed the add-kotlin-lsp-package branch 2 times, most recently from 15e3819 to 80ef8b1 Compare December 19, 2025 06:31
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels Dec 19, 2025
@ghost ghost mentioned this pull request Jan 5, 2026
1 task done
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
@jakubpawlowicz

Copy link
Copy Markdown
Contributor

I've tried running it locally and had to prevent kotlin-lsp.sh from trying to chmod java binary with:

  postInstall = ''
    substituteInPlace $out/lib/kotlin-lsp/kotlin-lsp.sh \
      --replace 'chmod +x "$LOCAL_JRE_PATH/bin/java"' '# chmod removed for NixOS'
  '';

@p-louis
p-louis force-pushed the add-kotlin-lsp-package branch from 6f76832 to 73ebcbf Compare January 7, 2026 08:31

@obreitwi obreitwi left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I had to make two adjustments for kotlin-lsp to work under macOS.

Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
Comment thread pkgs/by-name/ko/kotlin-lsp/package.nix
@liff

liff commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

The commits should be squashed to just:

  • maintainers: add p-louis
  • kotlin-lsp: init at 261.13587.0

@p-louis
p-louis force-pushed the add-kotlin-lsp-package branch from a708f32 to a730873 Compare January 8, 2026 09:09
@p-louis

p-louis commented Jan 8, 2026

Copy link
Copy Markdown
Author

I've squashed the commits down to

  • kotlin-lsp: update to v261.13587.0
  • maintainers: add p-louis
  • kotlin-lsp: init at 261.13587.0

I felt it a bad idea to squash the update commit down as well

@liff

liff commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

I don’t think a separate update commit is needed, since you are introducing a new package anyway.

kotlin-lsp: removed unneccessary ls from installPhase

The `ls -la` in question was only used in building this package and is
no longer required.

kotlin-lsp: correct license

Originally had a als20 instead of asl20

kotlin-lsp: removed unused buildInputs; add pre-/postInstall

kotlin-lsp: remove maven from binPath

kotlin-lsp: update to v261.13587.0

kotlin-lsp: add review suggestions
@p-louis
p-louis force-pushed the add-kotlin-lsp-package branch from a730873 to 8713d58 Compare January 15, 2026 09:26
@obreitwi

Copy link
Copy Markdown
Member

I felt it a bad idea to squash the update commit down as well

Unfortunately, the two changes for MacOS I had requested seem to have been lost while squashing, causing the PR to not build there.

@nixpkgs-ci nixpkgs-ci Bot added the 8.has: package (new) This PR adds a new package label Jan 26, 2026
@Andrew15-5 Andrew15-5 mentioned this pull request Feb 8, 2026
2 of 13 tasks

@axelkar axelkar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also my (parallel and more polished) PR here: #482845. Use it as inspiration as you wish.

Some notes from my implementation:

  • selectSystem helper for better error messages
  • Reduced auto-patchelf dependencies by removing unused libraries in included JRE
  • Test that kotlin-lsp --help works (JVM classpath and libraries loaded at init work)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fail on a mismatch, see #260776

Suggested change
--replace-fail 'chmod +x "$LOCAL_JRE_PATH/bin/java"' '# chmod removed for NixOS'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this path is different on darwin systems

chmod +x $out/lib/kotlin-lsp/jre/Contents/Home/bin/java

I'd suggest declaring similar to my PR
https://github.com/NixOS/nixpkgs/pull/492163/changes#diff-0317ed1f782055d57bad91c5c56282ba1e3f8e324f86a2fab5cb02882fc82dd3R29-R39

I've tested it on darwin with java_bin_path fix and it works fine

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested find solution also LGTM #435169 (comment)

@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 7, 2026
@Badya

Badya commented Apr 28, 2026

Copy link
Copy Markdown

@bew bew mentioned this pull request Apr 29, 2026
4 of 13 tasks

@bew bew left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! I've opened an alternative PR #514623 that improves the package in a number of ways:

  • fixing the license
  • avoiding depending on X11/Wayland packages (the lsp is headless, it has no need for graphical stuff!)
  • does not use the deprecated kotlin-lsp.sh launcher, but properly wraps the intellij-server as instructed in upstream project
  • adding support for .sit archives used for MacOS
  • adding version check to ensure the binary works in installCheck phase

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p-louis

p-louis commented Apr 29, 2026

Copy link
Copy Markdown
Author

Closing in favor of #514623

@p-louis p-louis closed this Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants