about summary refs log tree commit diff
diff options
context:
space:
mode:
authordevhell <devhell@mailfresser.de>2020-11-23 18:52:07 +0000
committerdevhell <devhell@mailfresser.de>2020-11-23 18:54:46 +0000
commitd8671b910f2526619626022b964fdf1ac4fbcf8f (patch)
tree1e7dfc25070d48d1ea033c7910ad47fae3a42344
parent2034d881e063acb4d0aea60f8791be2247ea289b (diff)
profiles/base: Rework ZSH configuration
I've been trying to get most of my environment directly configured via
my NixOS configuration rather than rely on my dotfiles repository, if
the program/configuration is well supported in NixOS.

Just like Vim, here too I'm relying more on NixOS' ZSH options, which
truly eliminates dependencies on external repositories or dotfile
setups.
-rw-r--r--modules/user/devhell/profiles/base.nix38
1 files changed, 36 insertions, 2 deletions
diff --git a/modules/user/devhell/profiles/base.nix b/modules/user/devhell/profiles/base.nix
index 0932f7bc..11fec531 100644
--- a/modules/user/devhell/profiles/base.nix
+++ b/modules/user/devhell/profiles/base.nix
@@ -66,7 +66,28 @@ in {
       };
       zsh = {
         enable = true;
-        enableCompletion = true;
+        promptInit = ''
+          eval "$(${pkgs.starship}/bin/starship init zsh)"
+        '';
+        interactiveShellInit = ''
+          zstyle ':completion:*' menu select
+          source ${pkgs.fzf}/share/fzf/key-bindings.zsh
+        '';
+        shellAliases = {
+          ls = "ls --color=auto";
+          grep = "grep --color=auto";
+          diff = "diff --color=auto";
+          ip = "ip --color=auto";
+        };
+        setOptions = [
+          "auto_cd"
+          "auto_pushd"
+          "correct"
+          "hist_fcntl_lock"
+          "hist_ignore_dups"
+          "hist_no_store"
+          "hist_reduce_blanks"
+        ];
       };
       bash = {
         enableCompletion = true;
@@ -92,7 +113,20 @@ in {
     };
 
     environment = {
-      shells = [ "/run/current-system/sw/bin/zsh" ];
+      shellInit = ''
+        export GPG_AGENT_INFO=$HOME/.gnupg/S.gpg-agent
+        export LIBVIRT_DEFAULT_URI=qemu:///system
+        export LS_COLORS="$(vivid generate snazzy)"
+        export LESS_TERMCAP_mb=$'\E[1;31m'
+        export LESS_TERMCAP_md=$'\E[1;36m'
+        export LESS_TERMCAP_me=$'\E[0m'
+        export LESS_TERMCAP_so=$'\E[01;33m'
+        export LESS_TERMCAP_se=$'\E[0m'
+        export LESS_TERMCAP_us=$'\E[1;32m'
+        export LESS_TERMCAP_ue=$'\E[0m'
+        export EDITOR='vim'
+      '';
+      shells = [ pkgs.zsh ];
     };
 
     fonts = {