mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/lsp/hls: handle automatic installation of required GHC
This commit is contained in:
parent
767eb62f48
commit
619e24366e
3 changed files with 43 additions and 3 deletions
|
@ -220,6 +220,7 @@ in
|
|||
++ [
|
||||
./ccls.nix
|
||||
./efmls-configs.nix
|
||||
./hls.nix
|
||||
./pylsp.nix
|
||||
./rust-analyzer.nix
|
||||
./svelte.nix
|
||||
|
|
34
plugins/lsp/language-servers/hls.nix
Normal file
34
plugins/lsp/language-servers/hls.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lsp.servers.hls;
|
||||
in
|
||||
{
|
||||
options.plugins.lsp.servers.hls = {
|
||||
installGhc = mkOption {
|
||||
type = with types; nullOr bool;
|
||||
default = null;
|
||||
example = true;
|
||||
description = "Whether to install `ghc`.";
|
||||
};
|
||||
|
||||
ghcPackage = mkPackageOption pkgs "ghc" { };
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
warnings = optional (cfg.installGhc == null) ''
|
||||
`hls` relies on `ghc` (the Glasgow Haskell Compiler).
|
||||
- Set `plugins.lsp.servers.hls.installGhc = true` to install it automatically with Nixvim.
|
||||
You can customize which package to install by changing `plugins.lsp.servers.hls.ghcPackage`.
|
||||
- Set `plugins.lsp.servers.hls.installGhc = false` to not have it install through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'';
|
||||
|
||||
extraPackages = with pkgs; (optional ((isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage);
|
||||
};
|
||||
}
|
|
@ -16,12 +16,17 @@ let
|
|||
plugins.lsp = {
|
||||
enable = true;
|
||||
|
||||
servers.rust_analyzer = {
|
||||
servers = {
|
||||
hls = {
|
||||
installGhc = true;
|
||||
};
|
||||
rust_analyzer = {
|
||||
installCargo = true;
|
||||
installRustc = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
enable-servers-module =
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue