Skip to content

Commit

Permalink
add nixd support
Browse files Browse the repository at this point in the history
  • Loading branch information
gvolpe committed Jul 29, 2023
1 parent 950b344 commit a94069d
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 5 deletions.
74 changes: 73 additions & 1 deletion flake.lock

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

10 changes: 9 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";

# nix lsp support
nixd.url = github:nix-community/nixd;

# Nix module docs generator
nmd.url = github:gvolpe/nmd;
#nmd.url = git+file:///home/gvolpe/workspace/nmd;
Expand Down Expand Up @@ -331,6 +334,7 @@
"flake-utils"
"neovim-nightly-flake"
"nmd"
"nixd"
"ts-build"
"tree-sitter-scala"
"tree-sitter-typescript"
Expand Down Expand Up @@ -369,10 +373,14 @@
neovim-nightly = inputs.neovim-nightly-overlay.packages.${system}.neovim;
};

nixdOverlay = f: p: {
inherit (inputs.nixd.packages.${system}) nixd;
};

pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
overlays = [ libOverlay pluginOverlay metalsOverlay neovimOverlay nmdOverlay tsOverlay ];
overlays = [ libOverlay pluginOverlay metalsOverlay neovimOverlay nmdOverlay nixdOverlay tsOverlay ];
};

default-ide = pkgs.callPackage ./lib/ide.nix {
Expand Down
17 changes: 14 additions & 3 deletions modules/lsp/lsp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ in
nix = {
enable = mkEnableOption "Nix LSP";
type = mkOption {
type = types.enum [ "nil" "rnix-lsp" ];
default = "rnix-lsp";
description = "Whether to use `nil` or `rnix-lsp`";
type = types.enum [ "nixd" "nil" "rnix-lsp" ];
default = "nil";
description = "Whether to use `nixd`, `nil` or `rnix-lsp`";
};
};

Expand Down Expand Up @@ -277,6 +277,17 @@ in
}
''}
${writeIf (cfg.nix.enable && cfg.nix.type == "nixd") ''
-- Nix config
lspconfig.nixd.setup{
capabilities = capabilities;
on_attach = function(client, bufnr)
attach_keymaps(client, bufnr)
end,
cmd = {"${pkgs.nixd}/bin/nixd"}
}
''}
${writeIf (cfg.nix.enable && cfg.nix.type == "nil") ''
-- Nix config
lspconfig.nil_ls.setup{
Expand Down

0 comments on commit a94069d

Please sign in to comment.