cc58d31953
* flake: Expose tests to allow running purely The existing way to run tests with `nix-shell` relies on impure usage of `<nixpkgs>`. This can lead to failures when the local nixpkgs is incompatible with the locked one. I.e., where CI is passing but a contributor may experience a failure. So, expose tests as `devShells.tests` to use the locked nixpkgs and allow easy invocation via `nix develop`. * tests: Remove impure path With Nix 2.10+ and pure evaluation mode e.g. ``` nix run nixpkgs/nixos-unstable#nixVersions.nix_2_10 -- develop -i .#tests.zplug-modules ``` this test would fail with: > error: the path '~/.customZplugHome' can not be resolved in pure mode Since the test only cares that it is a path, rather than anything about its contents, use a dummy empty directory.
53 lines
1.1 KiB
Nix
53 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
config = {
|
|
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@/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}'
|
|
'';
|
|
};
|
|
}
|