Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-scripts: Add a script to search for nvim-lspconfig server packages #2393

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

traxys
Copy link
Member

@traxys traxys commented Oct 8, 2024

This script generates a list on stdout of possible matches for nvim-lspconfig servers.
It can't easily generate something more advanced because a lot of lsp servers have false positives, for example groovy's default command is java -jar ....., this would match the java package, not the groovy language server.

@@ -0,0 +1,66 @@
#!/usr/bin/env python3
# This script requires nix-locate
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a nix shebang with nix-locate included?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure, I think nix-locate needs a nix-index database to be installzd

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, that sounds right... I think that's why I ended up adding nix-index-database to my flake.

Copy link
Member Author

Choose a reason for hiding this comment

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

I could add a dependency on https://github.com/nix-community/nix-index-database for this, but it's maybe a bit heavy?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I don't know if it's worth an extra input.

@@ -13,6 +13,7 @@
}:
lib.optionalAttrs (inputs.devshell ? flakeModule) {
devshells.default = {
packages = [ pkgs.python3 ];
Copy link
Contributor

Choose a reason for hiding this comment

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

or included in here?

@khaneliman
Copy link
Contributor

While working on #2399 it might be nice if we can use the script to check for whether a match exists, if it doesn't automatically add it to the unpackaged list in lsp-packages.nix to make this fully automated..

@traxys
Copy link
Member Author

traxys commented Oct 10, 2024

Well this is the use of this script, to help search for the corresponding nixkpkgs package

Copy link
Member

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

Don't see any issues, though I don't fully understand all design decisions.

@@ -13,6 +13,7 @@
}:
lib.optionalAttrs (inputs.devshell ? flakeModule) {
devshells.default = {
packages = [ pkgs.python3 ];
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why you're adding python to the devshell instead of packaging your script as a derivation (like we normally do)?

import os
import subprocess

repo = os.path.realpath(os.path.dirname(__file__) + "/../..")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this is why? I think there'd still be work-arounds, such as providing the relevant files at the CLI or via env vars. These could then be made available to the script via a wrapper or a patch/fixup phase in the drv builder.

@MattSturgeon
Copy link
Member

@traxys friendly bump 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants