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

languages/nix: add nixd to supported LSP servers #458

Open
wants to merge 3 commits into
base: v0.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
in
flake-parts.lib.mkFlake {
inherit inputs;
specialArgs = {inherit lib;};
} {
specialArgs = {
inherit lib;
};
}
{
Comment on lines +14 to +18
Copy link
Owner

Choose a reason for hiding this comment

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

Undo formatting changes.

# Allow users to bring their own systems.
# «https://github.com/nix-systems/nix-systems»
systems = import inputs.systems;
Expand Down Expand Up @@ -66,7 +69,12 @@
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
lsp = pkgs.mkShell {
packages = with pkgs; [nil statix deadnix alejandra];
packages = with pkgs; [
nil
statix
deadnix
alejandra
];
Comment on lines +72 to +77
Copy link
Owner

Choose a reason for hiding this comment

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

Undo.

};
};

Expand Down Expand Up @@ -111,6 +119,11 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
nixd = {
url = "github:nix-community/nixd";
inputs.nixpkgs.follows = "nixpkgs";
Elias-Ainsworth marked this conversation as resolved.
Show resolved Hide resolved
inputs.flake-utils.follows = "flake-utils";
};

## Plugins
# LSP plugins
Expand Down
1 change: 1 addition & 0 deletions flake/legacyPackages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(_: _: {
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
nil = inputs'.nil.packages.default;
nixd = inputs'.nixd.packages.default;
})
];
};
Expand Down
16 changes: 16 additions & 0 deletions modules/plugins/languages/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@
}
'';
};

nixd = {
package = pkgs.nixd;
internalFormatter = cfg.format.type == "nixpkgs-fmt";
lspConfig = ''
lspconfig.nixd.setup{
Copy link
Owner

Choose a reason for hiding this comment

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

Still missing on_attach.

capabilities = capabilities,
Elias-Ainsworth marked this conversation as resolved.
Show resolved Hide resolved
${
if (cfg.format.enable && cfg.format.type == "nixpkgs-fmt")
then useFormat
else noFormat
},
Comment on lines +84 to +88
Copy link
Owner

Choose a reason for hiding this comment

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

Is this necessary? Does nixd only support nixpkgs-fmt?

cmd = ${packageToCmd cfg.lsp.package "nixd"},
}
'';
};
};

defaultFormat = "alejandra";
Expand Down