summary refs log tree commit diff stats
path: root/user/modules/zsh.nix
diff options
context:
space:
mode:
authorAlan Pearce2019-10-05 01:41:47 +0200
committerAlan Pearce2019-10-05 01:41:47 +0200
commitc93dd657819ee2bafb49fe309cc1ee3aac5387e5 (patch)
treeee4ed1856c422b50b0361c447e114634a35cb346 /user/modules/zsh.nix
parentd1e7c31e93d3bb06e12eaa2c0954a617cb6755ec (diff)
downloadnixfiles-c93dd657819ee2bafb49fe309cc1ee3aac5387e5.tar.lz
nixfiles-c93dd657819ee2bafb49fe309cc1ee3aac5387e5.tar.zst
nixfiles-c93dd657819ee2bafb49fe309cc1ee3aac5387e5.zip
Use home-manager where possible for zsh configuration
Diffstat (limited to 'user/modules/zsh.nix')
-rw-r--r--user/modules/zsh.nix68
1 files changed, 67 insertions, 1 deletions
diff --git a/user/modules/zsh.nix b/user/modules/zsh.nix
index be545635..9ace6f75 100644
--- a/user/modules/zsh.nix
+++ b/user/modules/zsh.nix
@@ -3,7 +3,6 @@
 {
   home.file = {
     ".rm_recycle_home".text = ""; # use trash automatically in home directory
-    ".zshenv".text = builtins.readFile ../zsh/.zshenv;
   };
   home.packages = with pkgs; [
     fzf
@@ -17,4 +16,71 @@
     recursive = true;
     source = ../zsh/.config/zsh;
   };
+
+  programs.zsh = {
+    enable = true;
+
+    enableAutosuggestions = true;
+    enableCompletion = true;
+    defaultKeymap = "emacs";
+
+    dotDir = ".config/zsh";
+
+    history = {
+      expireDuplicatesFirst = true;
+      extended = true;
+      path = ".cache/zsh/history";
+      save = 20000;
+      size = 10000;
+    };
+
+    localVariables = {
+      ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=7";
+    };
+
+    # move to envExtra after 19.09
+    initExtra = ''
+      case $OSTYPE in
+        darwin*)
+          os=darwin
+          ;;
+        linux-gnu)
+          os=linux
+          ;;
+        freebsd*)
+          os=freebsd
+          ;;
+        *)
+          os=unknown
+          ;;
+      esac
+
+      case $MACHTYPE in
+        *64)
+          arch=amd64
+          ;;
+        *)
+          arch=386
+          ;;
+      esac
+      if [[ ''${path[(I)$HOME/.local/bin ]} ]]
+      then
+        path+=($HOME/.local/bin)
+      fi
+
+      if [[ ''${path[(I)$HOME/go/bin ]} ]]
+      then
+        path+=($HOME/go/bin)
+      fi
+
+      if [[ $HOST =~ satoshi ]]
+      then
+        EMAIL=alan@satoshipay.io
+      else
+        EMAIL=alan@alanpearce.eu
+      fi
+
+      export GHQ_ROOT="$HOME/projects:$HOME/go/src:$HOME/quicklisp/local-projects"
+    '' + builtins.readFile ../zsh/.config/zsh/.zshrc;
+  };
 }