mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 18:29:47 +01:00
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:
parent
21590d40c1
commit
288faaa5a6
2 changed files with 14 additions and 0 deletions
|
@ -31,6 +31,14 @@ in {
|
||||||
type = types.listOf pluginModule;
|
type = types.listOf pluginModule;
|
||||||
description = "List of zplug plugins.";
|
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 {
|
config = mkIf cfg.enable {
|
||||||
|
@ -39,6 +47,8 @@ in {
|
||||||
programs.zsh.initExtraBeforeCompInit = ''
|
programs.zsh.initExtraBeforeCompInit = ''
|
||||||
source ${pkgs.zplug}/init.zsh
|
source ${pkgs.zplug}/init.zsh
|
||||||
|
|
||||||
|
export ZPLUG_HOME=${cfg.zplugHome}
|
||||||
|
|
||||||
${optionalString (cfg.plugins != [ ]) ''
|
${optionalString (cfg.plugins != [ ]) ''
|
||||||
${concatStrings (map (plugin: ''
|
${concatStrings (map (plugin: ''
|
||||||
zplug "${plugin.name}"${
|
zplug "${plugin.name}"${
|
||||||
|
|
|
@ -8,6 +8,7 @@ with lib;
|
||||||
enable = true;
|
enable = true;
|
||||||
zplug = {
|
zplug = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
zplugHome = ~/.customZplugHome;
|
||||||
plugins = [
|
plugins = [
|
||||||
{
|
{
|
||||||
name = "plugins/git";
|
name = "plugins/git";
|
||||||
|
@ -43,6 +44,9 @@ with lib;
|
||||||
|
|
||||||
assertFileRegex home-files/.zshrc \
|
assertFileRegex home-files/.zshrc \
|
||||||
'^zplug load$'
|
'^zplug load$'
|
||||||
|
|
||||||
|
assertFileContains home-files/.zshrc \
|
||||||
|
'export ZPLUG_HOME=${config.programs.zsh.zplug.zplugHome}'
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue