diff --git a/modules/programs/zplug.nix b/modules/programs/zplug.nix index 6cb5e98e3..5f2b44311 100644 --- a/modules/programs/zplug.nix +++ b/modules/programs/zplug.nix @@ -31,6 +31,14 @@ in { type = types.listOf pluginModule; description = "List of zplug plugins."; }; + + zplugHome = mkOption { + type = types.path; + default = "${config.home.homeDirectory}/.zplug"; + defaultText = "~/.zplug"; + apply = toString; + description = "Path to zplug home directory."; + }; }; config = mkIf cfg.enable { @@ -39,6 +47,8 @@ in { programs.zsh.initExtraBeforeCompInit = '' source ${pkgs.zplug}/init.zsh + export ZPLUG_HOME=${cfg.zplugHome} + ${optionalString (cfg.plugins != [ ]) '' ${concatStrings (map (plugin: '' zplug "${plugin.name}"${ diff --git a/tests/modules/programs/zplug/modules.nix b/tests/modules/programs/zplug/modules.nix index 373b6b889..7c4abbc42 100644 --- a/tests/modules/programs/zplug/modules.nix +++ b/tests/modules/programs/zplug/modules.nix @@ -8,6 +8,7 @@ with lib; enable = true; zplug = { enable = true; + zplugHome = ~/.customZplugHome; plugins = [ { name = "plugins/git"; @@ -43,6 +44,9 @@ with lib; assertFileRegex home-files/.zshrc \ '^zplug load$' + + assertFileContains home-files/.zshrc \ + 'export ZPLUG_HOME=${config.programs.zsh.zplug.zplugHome}' ''; }; }