diff --git a/modules/programs/zplug.nix b/modules/programs/zplug.nix index 0df39529..6cb5e98e 100644 --- a/modules/programs/zplug.nix +++ b/modules/programs/zplug.nix @@ -45,11 +45,14 @@ in { optionalString (plugin.tags != [ ]) '' ${concatStrings (map (tag: ", ${tag}") plugin.tags)} '' - } + } '') cfg.plugins)} ''} - zplug install + if ! zplug check; then + zplug install + fi + zplug load ''; diff --git a/tests/modules/programs/zplug/modules.nix b/tests/modules/programs/zplug/modules.nix index 8ebf82b8..704c5c5e 100644 --- a/tests/modules/programs/zplug/modules.nix +++ b/tests/modules/programs/zplug/modules.nix @@ -38,8 +38,10 @@ with lib; assertFileContains home-files/.zshrc \ 'zplug "lib/clipboard", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]"' - assertFileRegex home-files/.zshrc \ - '^zplug install$' + assertFileContains home-files/.zshrc \ + 'if ! zplug check; then + zplug install + fi' assertFileRegex home-files/.zshrc \ '^zplug load$'