mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
modules/lsp: propagate pkgs arg to server modules
This allows simplifying the `importApply` and also paves the way for custom server modules to define arbitrary package options.
This commit is contained in:
parent
9e77c8e4a9
commit
bb9d744b64
2 changed files with 7 additions and 6 deletions
|
|
@ -12,10 +12,6 @@ let
|
|||
cfg = config.lsp;
|
||||
oldCfg = config.plugins.lsp;
|
||||
|
||||
# Import `server.nix` and apply args
|
||||
# For convenience, we set a default here for args.pkgs
|
||||
mkServerModule = args: lib.modules.importApply ./server.nix ({ inherit pkgs; } // args);
|
||||
|
||||
# Create a submodule type from `server.nix`
|
||||
# Used as the type for both the freeform `lsp.servers.<name>`
|
||||
# and the explicitly declared `lsp.servers.*` options
|
||||
|
|
@ -25,7 +21,12 @@ let
|
|||
# Server modules have a `config` option, so we must use
|
||||
# shorthandOnlyDefinesConfig to avoid confusing the module system.
|
||||
shorthandOnlyDefinesConfig = true;
|
||||
modules = [ (mkServerModule args) ];
|
||||
modules = [
|
||||
(lib.modules.importApply ./server.nix args)
|
||||
{
|
||||
_module.args.pkgs = pkgs;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Create a server option
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
name ? "the language server",
|
||||
package ? null,
|
||||
config ? null,
|
||||
pkgs ? { },
|
||||
}@args:
|
||||
{
|
||||
lib,
|
||||
name,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue