mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-09 03:56:05 +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 [
|
packages = lib.pipe enabledServers [
|
||||||
(builtins.filter (server: server ? package))
|
(builtins.catAttrs "packages")
|
||||||
(builtins.groupBy (server: if server.packageFallback then "suffix" else "prefix"))
|
(builtins.zipAttrsWith (_: builtins.concatLists))
|
||||||
(builtins.mapAttrs (_: builtins.catAttrs "package"))
|
|
||||||
];
|
];
|
||||||
in
|
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 {
|
config = lib.mkOption {
|
||||||
type = with types; attrsOf anything;
|
type = with types; attrsOf anything;
|
||||||
description = ''
|
description = ''
|
||||||
|
|
@ -88,6 +104,14 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
packages = lib.mkIf (config.package != null) {
|
||||||
|
${if config.packageFallback then "suffix" else "prefix"} = [
|
||||||
|
config.package
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./server-renames.nix
|
./server-renames.nix
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue