From e3e37741771d47b3c57329db9077f5eef30a9777 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 14 Sep 2024 12:16:15 -0500 Subject: [PATCH] plugins/neorg: use neorgTelescopePackage option --- plugins/by-name/neorg/default.nix | 13 ++++++++++++- .../plugins/by-name/neorg/default.nix | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/plugins/by-name/neorg/default.nix b/plugins/by-name/neorg/default.nix index d98e0d5f..ecfd9e3f 100644 --- a/plugins/by-name/neorg/default.nix +++ b/plugins/by-name/neorg/default.nix @@ -20,6 +20,11 @@ with lib; ]; }; + neorgTelescopePackage = lib.mkPackageOption pkgs [ + "vimPlugins" + "neorg-telescope" + ] { nullable = true; }; + lazyLoading = helpers.defaultNullOpts.mkBool false ''''; logger = @@ -148,12 +153,18 @@ with lib; Telescope support for neorg (`core.integrations.telescope`) is enabled but the telescope plugin is not. '') + ++ (optional (telescopeSupport && (cfg.neorgTelescopePackage == null)) '' + Telescope support for neorg (`core.integrations.telescope`) is enabled but the + `neorgTelescopePackage` package is not set. + '') ++ (optional ((hasAttr "core.defaults" cfg.modules) && (!config.plugins.treesitter.enable)) '' Neorg's `core.defaults` module is enabled but `plugins.treesitter` is not. Treesitter is required when using the `core.defaults`. ''); - extraPlugins = [ cfg.package ] ++ (optional telescopeSupport pkgs.vimPlugins.neorg-telescope); + extraPlugins = [ + cfg.package + ] ++ (optional (telescopeSupport && cfg.neorgTelescopePackage != null) cfg.neorgTelescopePackage); extraConfigLua = '' require('neorg').setup(${helpers.toLuaObject setupOptions}) diff --git a/tests/test-sources/plugins/by-name/neorg/default.nix b/tests/test-sources/plugins/by-name/neorg/default.nix index 9f6195ea..d472bb6e 100644 --- a/tests/test-sources/plugins/by-name/neorg/default.nix +++ b/tests/test-sources/plugins/by-name/neorg/default.nix @@ -75,13 +75,24 @@ }; telescope-integration = { + # TODO: re-enable when this will have been fixed upstream. + test.runNvim = false; plugins = { - telescope.enable = false; + telescope.enable = true; neorg = { - enable = false; + enable = true; modules."core.integrations.telescope".__empty = null; }; }; }; + + no-packages = { + # TODO: re-enable when this will have been fixed upstream. + test.runNvim = false; + plugins.neorg = { + enable = true; + neorgTelescopePackage = null; + }; + }; }