1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-20 09:19:41 +01:00

modules/lsp/hls: port ghcPackage option from plugins.lsp

This commit is contained in:
Matt Sturgeon 2025-10-09 20:35:45 +01:00
parent cf6c8ef1fa
commit e868bd6aa1
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 62 additions and 18 deletions

View 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
];
};
};
}