about summary refs log tree commit diff stats
path: root/services/zsh/zsh.nix
blob: b8079fd4148af746a4a481d617c7e80ddf64d292 (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{
  config,
  pkgs,
  ...
}: let
  path_config_cursor = builtins.writeFile ./custom_cursor;
in {
  programs.zsh = {
    enable = true;
    zsh-autoenv = {
      enable = true;
    };
    syntaxHighlighting = {
      enable = true;
    };
    shellAliases = {
      ls = "ls -a --color=auto";
      ll = ". ll";
      pip = "pip --require-virtualenv";
      hisea = "history info | grep";

      mocp = "mocp -M \"$XDG_CONFIG_HOME\"/moc";
      yarn = "yarn --use-yarnrc \"$XDG_CONFIG_HOME\"/yarn/config";
    };
    setOptions = [
      "AUTO_CD"
      "AUTO_PUSHD"
      "CHASE_DOTS"

      "ALWAYS_TO_END"

      "EXTENDED_HISTORY"
      "HIST_ALLOW_CLOBBER"
      "HIST_VERIFY"
      "HIST_FCNTL_LOCK"

      "DVORAK"
      "CORRECT"

      "PROMPT_SUBST"
      "TRANSIENT_RPROMPT" # maybe?

      "COMBINING_CHARS"
      "VI"
    ];

    promptInit =
      builtins.readFile ./zsh-prompt.sh;
    loginShellInit = ''
      eval $(ssh-agent -s) > /dev/null # start ssh agent
      export ENHANCHED_NEOFETCH="$(pacman -Qn | wc -l) (pacman), $(pacman -Qm | wc -l) (aur), $(($(cargo install --list | wc -l ) / 2)) (cargo)"
    '';
    interactiveShellInit = builtins.readFile ./zsh-init.sh;
    histSize = 9999999;
    histFile = "$XDG_DATA_HOME/zsh/history";
    autosuggestions = {
      enable = true;
    };
  };

  environment = {
    variables = {
      XDG_DATA_HOME = "$HOME/.local/share";
      XDG_STATE_HOME = "$HOME/.local/state";
      XDG_CACHE_HOME = "$HOME/.cache";
      XDG_CONFIG_HOME = "$HOME/.config";
      XDG_BIN_HOME = "\${HOME}/.local/bin";

      HISTSIZE = "9000000";
      TIMEFMT = "'$fg[green]%J$reset_color' time: $fg[blue]%*Es$reset_color, cpu: $fg[blue]%P$reset_color"; # no idea what this does or why it is needed
      REPORTTIME = "10";

      PATH = [
        "\${PATH}:/home/dt/repos/shell/scripts"
        "/home/dt/.local/bin"
        "/home/dt/.local/share/cargo/bin/"
      ];
      EDITOR = "nvim";
      IVIEWER = "imv";
      READER = "zathura";
      VISUAL = "nvim";
      CODEEDITOR = "nvim";
      TERMINAL = "alacritty";
      BROWSER = "firefox";
      COLORTERM = "truecolor";
      PAGER = "less -R";
      WM = "river";
      AWMWALLPAPER = "/home/dt/media/pictures/tes/wallpapers-linux_cast/Dedicated_Colorschemes/nord/Abstract-Nord.png";

      # FUNCNEST for more functions in functions
      FUNCNEST = "2000";

      WALLPAPERDIR = "$HOME/media/pictures/wallpapers/";
      LESS = "R";
      MANPAGER = "less -R --use-color -Dd+r -Du+b";
      LIBVIRT_DEFAULT_URI = "qemu:///system";
      BEMENU_SCALE = "1.5";
      BEMENU_BACKEND = "wayland";
      BEMENU_OPTS = "--fn 'Source Code Pro 10' -c -l 30 -B 1 -W 0.9 --hf #ffffff";

      # Clean the home dir {{{
      _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java -Djavafx.cachedir = \"$XDG_CACHE_HOME/openjfx\"";
      GRADLE_USER_HOME = "\"$XDG_DATA_HOME\"/gradle";
      CARGO_HOME = "\"$XDG_DATA_HOME\"/cargo";
      GNUPGHOME = "\"$XDG_DATA_HOME\"/gnupg";
      GOPATH = "\"$XDG_DATA_HOME\"/go";
      GTK2_RC_FILES = "\"$XDG_CONFIG_HOME\"/gtk-2.0/gtkrc";
      LESSHISFILE = "\"$XDG_CACHE_HOME\"/less/history";
      LESSKEYIN = "\"$XDG_CONFIG_HOME\"/less/lesskey";
      RUSTUP_HOME = "\"$XDG_DATA_HOME\"/rustup";
      NPM_CONFIG_USERCONFIG = "\"$XDG_CONFIG_HOME\"/npm/npmrc";
      NUGET_PACKAGES = "\"$XDG_CACHE_HOME\"/NuGetPackages";
      PYTHONSTARTUP = "\"$XDG_CONFIG_HOME\"/python/pythonrc";
      XAUTHORITY = "\"$XDG_RUNTIME_DIR\"/Xauthority";
      COMPDUMPFILE = "\"$XDG_DATA_DIR\"/zsh/.zcompdump}";
      IPYTHONDIR = "\"$XDG_CONFIG_HOME\"/ipython";
      PARALLEL_HOME = "\"$XDG_CONFIG_HOME\"/parallel";
      STACK_XDG = "1";
      # }}}

      # Export Wayland env Vars {{{
      QT_QPA_PLATFORM = "wayland";
      QT_QPA_PLATFORMTHEME = "qt5ct"; # needs qt5ct
      CLUTTER_BACKEND = "wayland";
      SDL_VIDEODRIVER = "wayland"; # might brake some things
      MOZ_ENABLE_WAYLAND = "1";
      # }}}
    };
  };
}