Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixvimInfo: access package.default using tryEval #2228

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/neovim-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
}@args:
let
namespace = if isColorscheme then "colorschemes" else "plugins";
extraConfigNamespace = if isColorscheme then "extraConfigLuaPre" else "extraConfigLua";

module =
{
Expand All @@ -60,14 +61,15 @@
let
cfg = config.${namespace}.${name};
opt = options.${namespace}.${name};
extraConfigNamespace = if isColorscheme then "extraConfigLuaPre" else "extraConfigLua";
# `package.default` will throw "not found in pkgs" if the nixpkgs channel is mismatched
pkg = (builtins.tryEval opt.package.default).value;
url = args.url or pkg.meta.homepage or null;
in
{
meta = {
inherit maintainers;
nixvimInfo = {
inherit description;
url = args.url or opt.package.default.meta.homepage;
inherit url description;
path = [
namespace
name
Expand Down
6 changes: 4 additions & 2 deletions lib/vim-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@
let
cfg = config.${namespace}.${name};
opt = options.${namespace}.${name};
# `package.default` will throw "not found in pkgs" if the nixpkgs channel is mismatched
pkg = (builtins.tryEval opt.package.default).value;
url = args.url or pkg.meta.homepage or null;
in
{
meta = {
inherit maintainers;
nixvimInfo = {
inherit description;
url = args.url or opt.package.default.meta.homepage;
inherit url description;
path = [
namespace
name
Expand Down
5 changes: 4 additions & 1 deletion plugins/lsp/language-servers/_mk-lsp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ with lib;
let
cfg = config.plugins.lsp.servers.${name};
opt = options.plugins.lsp.servers.${name};
# `package.default` will throw "not found in pkgs" if the nixpkgs channel is mismatched
pkg = (builtins.tryEval opt.package.default).value;
url = args.url or pkg.meta.homepage or null;
in
{
meta.nixvimInfo = {
# TODO: description
url = args.url or opt.package.default.meta.homepage or null;
inherit url;
path = [
"plugins"
"lsp"
Expand Down