mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-20 01:09:41 +01:00
modules/lsp/hls: port ghcPackage option from plugins.lsp
This commit is contained in:
parent
cf6c8ef1fa
commit
e868bd6aa1
3 changed files with 62 additions and 18 deletions
38
modules/lsp/servers/custom/hls.nix
Normal file
38
modules/lsp/servers/custom/hls.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options = {
|
||||
installGhc = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether to install `ghc`.";
|
||||
};
|
||||
|
||||
ghcPackage = lib.mkPackageOption pkgs "ghc" { };
|
||||
};
|
||||
|
||||
config = lib.mkIf config.enable {
|
||||
warnings = lib.nixvim.mkWarnings "lsp.servers.hls" {
|
||||
when = options.installGhc.highestPrio == 1500;
|
||||
message = ''
|
||||
`hls` relies on `ghc` (the Glasgow Haskell Compiler).
|
||||
- Set `${options.installGhc} = true` to install it automatically with Nixvim.
|
||||
You can customize which package to install by changing `${options.ghcPackage}`.
|
||||
- Set `${options.installGhc} = false` to not have it install through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'';
|
||||
};
|
||||
|
||||
packages = lib.mkIf config.installGhc {
|
||||
${if config.packageFallback then "suffix" else "prefix"} = [
|
||||
config.ghcPackage
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue