summaryrefslogtreecommitdiff
path: root/user-profiles/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'user-profiles/zsh')
-rw-r--r--user-profiles/zsh/default.nix98
-rw-r--r--user-profiles/zsh/zshrc6
2 files changed, 66 insertions, 38 deletions
diff --git a/user-profiles/zsh/default.nix b/user-profiles/zsh/default.nix
index 428e2459..87d0fa4b 100644
--- a/user-profiles/zsh/default.nix
+++ b/user-profiles/zsh/default.nix
@@ -1,38 +1,72 @@
1{ userName, pkgs, customUtils, lib, config, ... }: 1{ userName, pkgs, customUtils, lib, config, ... }:
2let 2{
3 dotDir = ".config/zsh"; 3 config = {
4 p10kZsh = "${dotDir}/.p10k.zsh"; 4 nixpkgs.externalConfig.allowUnfreePackages = [
5 cfg = config.home-manager.users.${userName}; 5 "zsh-abbr"
6in { 6 ];
7 home-manager.users.${userName} = {
8 programs.zsh = {
9 inherit dotDir;
10 enable = true;
11 autocd = true;
12 enableCompletion = true;
13 7
14 plugins = [ 8 home-manager.users.${userName} = let sysConfig = config; in { config, ... }: {
15 { name = "powerlevel10k"; 9 config = {
16 file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; 10 programs.zsh = {
17 src = pkgs.zsh-powerlevel10k; 11 dotDir = "${config.xdg.configHome}/zsh";
18 } 12 enable = true;
19 ]; 13 autocd = true;
20 initExtraFirst = '' 14 enableCompletion = true;
21 if [[ $TERM == "dumb" ]]; then 15 enableVteIntegration = true;
22 unsetopt zle 16 history = {
23 PS1='$ ' 17 append = true;
24 return 18 expireDuplicatesFirst = true;
25 fi 19 extended = true;
26 ''; 20 findNoDups = true;
27 initExtraBeforeCompInit = '' 21 };
28 source "${cfg.home.homeDirectory}/${p10kZsh}" 22 syntaxHighlighting.enable = true;
29 ''; 23 zsh-abbr = {
30 initExtra = lib.mkAfter '' 24 enable = true;
31 source ${./zshrc} 25 abbreviations = {
32 source "${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 26 re = "systemctl restart";
33 ''; 27 ure = "systemctl --user restart";
28 st = "systemctl status";
29 ust = "systemctl --user status";
30 };
31 globalAbbreviations = {
32 "L" = "| less";
33 "S" = "&> /dev/null";
34 "G" = "| grep";
35 "B" = "&> /dev/null &";
36 "BB" = "&> /dev/null &!";
37 "J" = lib.mkIf config.programs.jq.enable "| jq '.'";
38 };
39 };
40
41 plugins = [
42 { name = "powerlevel10k";
43 file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
44 src = pkgs.zsh-powerlevel10k;
45 }
46 ];
47 initContent = lib.mkMerge [
48 (lib.mkBefore ''
49 if [[ $TERM == "dumb" ]]; then
50 unsetopt zle
51 PS1='$ '
52 return
53 fi
54 '')
55 (lib.mkOrder 550 ''
56 source "$HOME/${config.xdg.configFile."zsh/.p10k.zsh".target}"
57 '')
58 (lib.mkAfter ''
59 source ${./zshrc}
60 '')
61 ];
62 };
63
64 xdg.configFile."zsh/.p10k.zsh".source = ./p10k.zsh;
65 };
34 }; 66 };
35 67
36 home.file.${p10kZsh}.source = ./p10k.zsh; 68 programs.zsh.enable = true;
69 environment.pathsToLink = [ "/share/zsh" ];
70 environment.shellAliases = lib.mkOverride 90 {};
37 }; 71 };
38} 72}
diff --git a/user-profiles/zsh/zshrc b/user-profiles/zsh/zshrc
index ed614182..af3aca64 100644
--- a/user-profiles/zsh/zshrc
+++ b/user-profiles/zsh/zshrc
@@ -33,9 +33,3 @@ zle -N self-insert url-quote-magic
33zle -N bracketed-paste bracketed-paste-magic 33zle -N bracketed-paste bracketed-paste-magic
34 34
35setopt extended_glob 35setopt extended_glob
36
37alias -g L='| less'
38alias -g S='&> /dev/null'
39alias -g G='| grep'
40alias -g B='&> /dev/null &'
41alias -g BB='&> /dev/null &!'