mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
modules/lsp: allow servers to install multiple packages
Adds two internal per-server options: `packages.prefix` & `packages.suffix`. These options allow the server module to install multiple packages, and control which end up being prefixed or suffixed on the PATH. This simplifies the propagating code in `modules/lsp/servers/default.nix`, which can now zip up the enabled server `packages` attrs.
This commit is contained in:
parent
2414e8e99f
commit
9e77c8e4a9
2 changed files with 26 additions and 3 deletions
|
|
@ -153,9 +153,8 @@ in
|
|||
];
|
||||
|
||||
packages = lib.pipe enabledServers [
|
||||
(builtins.filter (server: server ? package))
|
||||
(builtins.groupBy (server: if server.packageFallback then "suffix" else "prefix"))
|
||||
(builtins.mapAttrs (_: builtins.catAttrs "package"))
|
||||
(builtins.catAttrs "packages")
|
||||
(builtins.zipAttrsWith (_: builtins.concatLists))
|
||||
];
|
||||
in
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,6 +64,22 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
packages.prefix = lib.mkOption {
|
||||
type = types.listOf types.package;
|
||||
description = "Packages to prefix onto the PATH.";
|
||||
default = [ ];
|
||||
visible = false;
|
||||
internal = true;
|
||||
};
|
||||
|
||||
packages.suffix = lib.mkOption {
|
||||
type = types.listOf types.package;
|
||||
description = "Packages to suffix onto the PATH.";
|
||||
default = [ ];
|
||||
visible = false;
|
||||
internal = true;
|
||||
};
|
||||
|
||||
config = lib.mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
description = ''
|
||||
|
|
@ -88,6 +104,14 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
packages = lib.mkIf (config.package != null) {
|
||||
${if config.packageFallback then "suffix" else "prefix"} = [
|
||||
config.package
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./server-renames.nix
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue