home-manager/tests/modules/programs/zplug/modules.nix
2023-07-08 10:12:35 +02:00

48 lines
1 KiB
Nix

{ config, pkgs, ... }:
{
programs.zsh = {
enable = true;
zplug = {
enable = true;
zplugHome = pkgs.emptyDirectory;
plugins = [
{
name = "plugins/git";
tags = [ "from:oh-my-zsh" ];
}
{
name = "lib/clipboard";
tags = [ "from:oh-my-zsh" ''if:"[[ $OSTYPE == *darwin* ]]"'' ];
}
];
};
};
test.stubs = {
zplug = { };
zsh = { };
};
nmt.script = ''
assertFileContains home-files/.zshrc \
'source @zplug@/share/zplug/init.zsh'
assertFileContains home-files/.zshrc \
'zplug "plugins/git", from:oh-my-zsh'
assertFileContains home-files/.zshrc \
'zplug "lib/clipboard", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]"'
assertFileContains home-files/.zshrc \
'if ! zplug check; then
zplug install
fi'
assertFileRegex home-files/.zshrc \
'^zplug load$'
assertFileContains home-files/.zshrc \
'export ZPLUG_HOME=${config.programs.zsh.zplug.zplugHome}'
'';
}