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 1 commit
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.

21 changes: 17 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
lib = import ./lib/stdlib-extended.nix inputs;
in
flake-parts.lib.mkFlake {
flake-parts.lib.mkFlake
Elias-Ainsworth marked this conversation as resolved.
Show resolved Hide resolved
{
inherit inputs;
specialArgs = {inherit lib;};
} {
specialArgs = {
inherit lib;
};
}
{
# Allow users to bring their own systems.
# «https://github.com/nix-systems/nix-systems»
systems = import inputs.systems;
Expand Down Expand Up @@ -66,7 +70,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
];
};
};

Expand Down Expand Up @@ -111,6 +120,10 @@
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
};

## 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{
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
},
cmd = ${packageToCmd cfg.lsp.package "nixd"},
}
'';
};
};

defaultFormat = "alejandra";
Expand Down