mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-14 04:51:11 +01:00
modules/lsp: fix mkServerOption homepage tryEval evaluation
`lib.pipe` strictly evaluates intermediate steps using `foldl'`. As a result, piping `(opts: opts.package.default or null)` → `(package: (tryEval package).value)` is ineffective because `opts.package.default` is evaluated before `tryEval` can catch exceptions. Instead, inline `opts.package.default` directly into the `tryEval` expression, ensuring missing package errors caught correctly. Resolves errors when building NixOS or nix-darwin docs that include Nixvim options. Adds a regression test.
This commit is contained in:
parent
6ab2b305da
commit
463fb0ad5d
2 changed files with 52 additions and 4 deletions
|
|
@ -40,10 +40,10 @@ let
|
|||
# Get suboptions of `lsp.servers.<name>`
|
||||
(opts: opts.${name}.type.getSubOptions opts.${name}.loc)
|
||||
# Get the default package
|
||||
(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)
|
||||
#
|
||||
# Use tryEval to catch throws when mkPackageOption can't find the package,
|
||||
# e.g., due to a mismatched nixpkgs revision
|
||||
(opts: (builtins.tryEval (opts.package.default or null)).value)
|
||||
# Get package's homepage
|
||||
(package: package.meta.homepage or null)
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue