lsp: add haskell language server

This commit is contained in:
Pedro Alves 2022-12-01 14:05:35 +00:00
parent bc045bd50a
commit 36bc31ed5c
4 changed files with 109 additions and 14 deletions

View file

@ -66,6 +66,12 @@ in
folding = mkEnableOption "Enable tree-sitter based folding"; folding = mkEnableOption "Enable tree-sitter based folding";
}; };
grammarPackages = mkOption {
type = with types; listOf package;
default = pkgs.tree-sitter.allGrammars;
description = "Grammar packages to install";
};
}; };
config = config =
@ -107,7 +113,7 @@ in
''; '';
extraPlugins = with pkgs; if cfg.nixGrammars then extraPlugins = with pkgs; if cfg.nixGrammars then
[ (vimPlugins.nvim-treesitter.withPlugins (_: tree-sitter.allGrammars)) ] [ (vimPlugins.nvim-treesitter.withPlugins (_: cfg.grammarPackages)) ]
else [ vimPlugins.nvim-treesitter ]; else [ vimPlugins.nvim-treesitter ];
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ]; extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];

View file

@ -78,6 +78,11 @@ let
name = "zls"; name = "zls";
description = "Enable zls, for Zig."; description = "Enable zls, for Zig.";
} }
{
name = "hls";
description = "Enable haskell language server";
packages = [ pkgs.haskell-language-server ];
}
]; ];
in in
{ {

88
tests/flake.lock generated
View file

@ -46,6 +46,25 @@
"type": "github" "type": "github"
} }
}, },
"build-ts": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1669771646,
"narHash": "sha256-IfH9zCq0+QpAB8D1ClhISfWcR59mSDsi91/2NW0RWfs=",
"owner": "pta2002",
"repo": "build-ts-grammar.nix",
"rev": "bba8a5b14a4632f25411dbf0fb01de69e999ce82",
"type": "github"
},
"original": {
"owner": "pta2002",
"repo": "build-ts-grammar.nix",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1667395993,
@ -91,6 +110,37 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_4": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gleam": {
"flake": false,
"locked": {
"lastModified": 1669665314,
"narHash": "sha256-aeho84P91cH13j7uLJwyD/zj8O/peROrpfa41HA/FGo=",
"owner": "gleam-lang",
"repo": "tree-sitter-gleam",
"rev": "97611918f79643ade377a156f3e4192cd50dc3e6",
"type": "github"
},
"original": {
"owner": "gleam-lang",
"repo": "tree-sitter-gleam",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1663491030, "lastModified": 1663491030,
@ -135,28 +185,42 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1663491030,
"narHash": "sha256-MVsfBhE9US5DvLtBAaTRjwYdv1tLO8xjahM8qLXTgTo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "767542707d394ff15ac1981e903e005ba69528b5",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"beautysh": "beautysh", "beautysh": "beautysh",
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_3",
"nmdSrc": "nmdSrc" "nmdSrc": "nmdSrc"
}, },
"locked": { "locked": {
"lastModified": 0, "lastModified": 0,
"narHash": "sha256-sjdU/aCTVFGSDxU+jxgaHtDsZQeFNb1nA55wRPgc3tU=", "narHash": "sha256-HWr75pPDcv+OM0BRyQUtIDPJ4W1V1iDzsEVXY6JQz6E=",
"path": "/nix/store/5wxj9v7dzrga7xvp4pr825ph20i1qb42-source", "path": "/nix/store/hgr3qr1x8gndpdkaj8cx2xclmd7v20b9-source",
"type": "path" "type": "path"
}, },
"original": { "original": {
"path": "/nix/store/5wxj9v7dzrga7xvp4pr825ph20i1qb42-source", "path": "/nix/store/hgr3qr1x8gndpdkaj8cx2xclmd7v20b9-source",
"type": "path" "type": "path"
} }
}, },
"nixvim-stable": { "nixvim-stable": {
"inputs": { "inputs": {
"beautysh": "beautysh_2", "beautysh": "beautysh_2",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_4",
"nixpkgs": [ "nixpkgs": [
"nixpkgs-stable" "nixpkgs-stable"
], ],
@ -164,12 +228,12 @@
}, },
"locked": { "locked": {
"lastModified": 0, "lastModified": 0,
"narHash": "sha256-sjdU/aCTVFGSDxU+jxgaHtDsZQeFNb1nA55wRPgc3tU=", "narHash": "sha256-HWr75pPDcv+OM0BRyQUtIDPJ4W1V1iDzsEVXY6JQz6E=",
"path": "/nix/store/5wxj9v7dzrga7xvp4pr825ph20i1qb42-source", "path": "/nix/store/hgr3qr1x8gndpdkaj8cx2xclmd7v20b9-source",
"type": "path" "type": "path"
}, },
"original": { "original": {
"path": "/nix/store/5wxj9v7dzrga7xvp4pr825ph20i1qb42-source", "path": "/nix/store/hgr3qr1x8gndpdkaj8cx2xclmd7v20b9-source",
"type": "path" "type": "path"
} }
}, },
@ -261,8 +325,10 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "build-ts": "build-ts",
"nixpkgs": "nixpkgs", "flake-utils": "flake-utils_2",
"gleam": "gleam",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nixvim": "nixvim", "nixvim": "nixvim",
"nixvim-stable": "nixvim-stable" "nixvim-stable": "nixvim-stable"

View file

@ -4,13 +4,17 @@
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixvim.url = "./.."; inputs.nixvim.url = "./..";
inputs.build-ts.url = "github:pta2002/build-ts-grammar.nix";
inputs.gleam.url = "github:gleam-lang/tree-sitter-gleam";
inputs.gleam.flake = false;
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-22.05"; inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-22.05";
inputs.nixvim-stable = { inputs.nixvim-stable = {
url = "./.."; url = "./..";
inputs.nixpkgs.follows = "nixpkgs-stable"; inputs.nixpkgs.follows = "nixpkgs-stable";
}; };
outputs = { self, nixvim, nixvim-stable, nixpkgs, flake-utils, nixpkgs-stable, ... }: outputs = { self, nixvim, nixvim-stable, nixpkgs, flake-utils, nixpkgs-stable, build-ts, gleam, ... }:
(flake-utils.lib.eachDefaultSystem (flake-utils.lib.eachDefaultSystem
(system: (system:
let let
@ -238,6 +242,20 @@
Normal.fg = "#ff0000"; Normal.fg = "#ff0000";
}; };
}; };
ts-custom = build {
plugins.treesitter = {
enable = true;
nixGrammars = true;
grammarPackages = [
(build-ts.lib.buildGrammar pkgs {
language = "gleam";
version = "0.25.0";
source = gleam;
})
];
};
};
}; };
})) // { })) // {
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem { nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {