summaryrefslogtreecommitdiff
path: root/user-profiles/zsh/default.nix
blob: daeb7e822b92b3d36e49f09b6a6ab93f4a9017ea (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
{ userName, pkgs, customUtils, lib, config, ... }:
let
  dotDir = ".config/zsh";
  p10kZsh = "${dotDir}/.p10k.zsh";
  cfg = config.home-manager.users.${userName};
in {
  home-manager.users.${userName} = {
    programs.zsh = {
      inherit dotDir;
      enable = true;
      autocd = true;
      enableCompletion = true;
      
      plugins = [
        { name = "powerlevel10k";
          file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
          src = pkgs.zsh-powerlevel10k;
        }
      ];
      initExtraFirst = ''
        if [[ $TERM == "dumb" ]]; then
          unsetopt zle
          PS1='$ '
          return
        fi
      '';
      initExtraBeforeCompInit = ''
        source "${cfg.home.homeDirectory}/${p10kZsh}"
      '';
      initExtra = lib.mkAfter ''
        source ${./zshrc}
        source "${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
      '';
    };

    home.file.${p10kZsh}.source = ./p10k.zsh;
  };
}