programs.zsh.zplug: add zplugHome option

Add an option to set custom `$ZPLUG_HOME`. Changing it with
`home.sessionVariables` doesnt work, since it has to be exported
before Zplug is initialised
This commit is contained in:
flexagoon 2021-10-17 00:35:03 +03:00 committed by Robert Helgesson
parent 21590d40c1
commit 288faaa5a6
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 14 additions and 0 deletions

View file

@ -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}"${