diff --git a/modules/terminal/toggleterm/config.nix b/modules/terminal/toggleterm/config.nix index 4bf85591..868dec4e 100644 --- a/modules/terminal/toggleterm/config.nix +++ b/modules/terminal/toggleterm/config.nix @@ -9,7 +9,8 @@ with builtins; let toggleKey = ""; in { config = mkMerge [ - (mkIf cfg.enable { + ( + mkIf cfg.enable { vim.startPlugins = [ "toggleterm-nvim" ]; @@ -39,10 +40,17 @@ in { ( mkIf (cfg.enable && cfg.lazygit.enable) { - vim.luaConfigRC.toggleterm-lazygit = mkIf cfg.lazygit.enable nvim.dag.entryAfter ["toggleterm"] '' + vim.startPlugins = lib.optionals (cfg.lazygit.package != null) [ + cfg.lazygit.package + ]; + vim.luaConfigRC.toggleterm-lazygit = nvim.dag.entryAfter ["toggleterm"] '' local terminal = require 'toggleterm.terminal' local lazygit = terminal.Terminal:new({ - cmd = "lazygit", + cmd = '${ + if (cfg.lazygit.package != null) + then getExe cfg.lazygit.package + else "lazygit" + }', direction = '${cfg.lazygit.direction}', hidden = true, on_open = function(term) diff --git a/modules/terminal/toggleterm/toggleterm.nix b/modules/terminal/toggleterm/toggleterm.nix index a3e5a426..e304bf68 100644 --- a/modules/terminal/toggleterm/toggleterm.nix +++ b/modules/terminal/toggleterm/toggleterm.nix @@ -1,4 +1,5 @@ { + pkgs, config, lib, ... @@ -24,6 +25,11 @@ with builtins; { default = "float"; description = "Direction of the lazygit window"; }; + package = mkOption { + type = with types; nullOr package; + default = pkgs.lazygit; + description = "The package to use for lazygit, null means do not install automatically"; + }; }; }; }