From f488f772ee3ad67767863d5b15ab390a75a505fd Mon Sep 17 00:00:00 2001
From: Felix Tenley <dev@felschr.com>
Date: Sat, 14 Mar 2020 01:38:34 +0100
Subject: [PATCH] feat: setup zsh as default shell

---
 home-pc.nix            |  2 +-
 home/shell/default.nix | 66 ++++++++++++++++++++++++++++++++++++++----
 home/shell/direnv.nix  | 15 ----------
 home/shell/shell.nix   | 21 --------------
 work-pc.nix            |  2 +-
 5 files changed, 63 insertions(+), 43 deletions(-)
 delete mode 100644 home/shell/direnv.nix
 delete mode 100644 home/shell/shell.nix

diff --git a/home-pc.nix b/home-pc.nix
index 7240cc0..06b0d55 100644
--- a/home-pc.nix
+++ b/home-pc.nix
@@ -24,7 +24,7 @@
   users.users.felschr = {
     isNormalUser = true;
     extraGroups = [ "wheel" "audio" ];
-    shell = pkgs.fish;
+    shell = pkgs.zsh;
   };
 
   home-manager.users.felschr = import ./home/felschr.nix;
diff --git a/home/shell/default.nix b/home/shell/default.nix
index 31b4ac4..7c48c90 100644
--- a/home/shell/default.nix
+++ b/home/shell/default.nix
@@ -1,8 +1,64 @@
 { config, pkgs, ... }:
 
+let
+  shellAliases = {
+    emacs = "emacsclient -c";
+  };
+in
 {
-  imports = [
-    ./shell.nix
-    ./direnv.nix
-  ];
-}
+  programs.fzf = {
+    enable = true;
+  };
+  programs.starship = {
+    enable = true;
+    settings = {
+      add_newline = false;
+      line_break = {
+        disabled = true;
+      };
+    };
+  };
+
+  programs.zsh = {
+    enable = true;
+    enableAutosuggestions = true;
+    autocd = true;
+    defaultKeymap = "viins";
+    initExtraBeforeCompInit = with pkgs; ''
+      source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+      source ${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh
+    '';
+    initExtra = ''
+      zstyle ':completion:*' menu select
+      setopt histignoredups
+      bindkey '^[[A' history-substring-search-up
+      bindkey '^[[B' history-substring-search-down
+      bindkey -M vicmd 'k' history-substring-search-up
+      bindkey -M vicmd 'j' history-substring-search-down
+    '';
+    history.extended = true;
+    inherit shellAliases;
+  };
+
+  programs.fish = {
+    enable = true;
+    shellInit = ''
+      fish_vi_key_bindings
+    '';
+    inherit shellAliases;
+  };
+
+  programs.bash = {
+    enable = true;
+    inherit shellAliases;
+  };
+
+  programs.direnv = {
+    enable = true;
+    stdlib = builtins.readFile ./.direnvrc;
+  };
+
+  home.file.".envrc".text = ''
+    dotenv
+  '';
+} 
diff --git a/home/shell/direnv.nix b/home/shell/direnv.nix
deleted file mode 100644
index ee3d9a2..0000000
--- a/home/shell/direnv.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ config, pkgs, ... }:
-
-with pkgs;
-{
-  programs.direnv = {
-    enable = true;
-    enableBashIntegration = true;
-    enableFishIntegration = true;
-    stdlib = builtins.readFile ./.direnvrc;
-  };
-
-  home.file.".envrc".text = ''
-    dotenv
-  '';
-}
diff --git a/home/shell/shell.nix b/home/shell/shell.nix
deleted file mode 100644
index 330cd90..0000000
--- a/home/shell/shell.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-{ config, pkgs, ... }:
-
-let
-  shellAliases = {
-    emacs = "emacsclient -c";
-  };
-in
-{
-  programs.fish = {
-    enable = true;
-    shellInit = ''
-      fish_vi_key_bindings
-    '';
-    inherit shellAliases;
-  };
-
-  programs.bash = {
-    enable = true;
-    inherit shellAliases;
-  };
-} 
diff --git a/work-pc.nix b/work-pc.nix
index 772cf07..277a1e5 100644
--- a/work-pc.nix
+++ b/work-pc.nix
@@ -27,7 +27,7 @@
   users.users.felschr = {
     isNormalUser = true;
     extraGroups = [ "wheel" "audio" "docker" "disk" "vboxusers" ];
-    shell = pkgs.fish;
+    shell = pkgs.zsh;
   };
 
   home-manager.users.felschr = import ./home/felschr-work.nix;