mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
modules/lsp: handle missing package in server option desc
The `lsp.servers.<name>` option description links to the server's homepage if it can evaluate the default package's `meta.homepage`. However, users may evaluate this description, e.g. when building NixOS docs with `documentation.nixos.includeAllModules`. Further, users may have a different nixpkgs revisions to ours. Therefore, we need to allow for the package not being in nixpkgs. Since `mkPackageOption` will throw in the default, we can catch it with `tryEval`.
This commit is contained in:
parent
9023e15e60
commit
20a7c92306
1 changed files with 7 additions and 2 deletions
|
|
@ -31,8 +31,13 @@ let
|
||||||
(opt: opt.type.getSubOptions opt.loc)
|
(opt: opt.type.getSubOptions opt.loc)
|
||||||
# Get suboptions of `lsp.servers.<name>`
|
# Get suboptions of `lsp.servers.<name>`
|
||||||
(opts: opts.${name}.type.getSubOptions opts.${name}.loc)
|
(opts: opts.${name}.type.getSubOptions opts.${name}.loc)
|
||||||
# Get package option's homepage
|
# Get the default package
|
||||||
(opts: opts.package.default.meta.homepage or null)
|
(opts: opts.package.default or null)
|
||||||
|
# The default throws if mkPackageOption can't find the package
|
||||||
|
# E.g. mismatched nixpkgs revision
|
||||||
|
(package: (builtins.tryEval package).value)
|
||||||
|
# Get package's homepage
|
||||||
|
(package: package.meta.homepage or null)
|
||||||
];
|
];
|
||||||
|
|
||||||
# If there's a known homepage for this language server,
|
# If there's a known homepage for this language server,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue