aboutsummaryrefslogtreecommitdiff
path: root/tests/modules/programs/zplug/modules.nix
blob: 704c5c5e2ef25a84b5f63367a7a9b03a142668be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ config, lib, pkgs, ... }:

with lib;

{
  config = {
    programs.zsh = {
      enable = true;
      zplug = {
        enable = true;
        plugins = [
          {
            name = "plugins/git";
            tags = [ "from:oh-my-zsh" ];
          }
          {
            name = "lib/clipboard";
            tags = [ "from:oh-my-zsh" ''if:"[[ $OSTYPE == *darwin* ]]"'' ];
          }
        ];
      };
    };

    nixpkgs.overlays = [
      (self: super: {
        zsh = pkgs.writeScriptBin "dummy-zsh" "";
        zplug = pkgs.writeScriptBin "dummy-zplug" "";
      })
    ];

    nmt.script = ''
      assertFileRegex home-files/.zshrc \
        '^source ${builtins.storeDir}/.*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$'
    '';
  };
}