From 6aeca28f860b9fa864b12b1d60bf0114e7e97448 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Fri, 31 Jan 2025 20:06:43 +0100 Subject: [PATCH] programs/terminal/shell: switch to zsh --- modules/programs/terminal/shell/default.nix | 13 ++++++ modules/programs/terminal/shell/nushell.nix | 7 --- modules/programs/terminal/shell/zsh.nix | 51 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 modules/programs/terminal/shell/zsh.nix diff --git a/modules/programs/terminal/shell/default.nix b/modules/programs/terminal/shell/default.nix index 4612e64..49fc42c 100644 --- a/modules/programs/terminal/shell/default.nix +++ b/modules/programs/terminal/shell/default.nix @@ -1,7 +1,20 @@ { + lib, + pkgs, + config, + ... +}: let + inherit (lib) mkIf; + inherit (config.local.systemVars) username; +in { imports = [ ./starship.nix ./nushell.nix ./zoxide.nix + ./zsh.nix ]; + + config = mkIf config.local.profiles.desktop.enable { + users.users.${username}.shell = pkgs.zsh; + }; } diff --git a/modules/programs/terminal/shell/nushell.nix b/modules/programs/terminal/shell/nushell.nix index 61f70e5..0f5b250 100644 --- a/modules/programs/terminal/shell/nushell.nix +++ b/modules/programs/terminal/shell/nushell.nix @@ -13,7 +13,6 @@ zoxideCache = "${config.hjem.users.${username}.directory}/.cache/zoxide"; in { config = mkIf config.local.profiles.desktop.enable { - users.users.${username}.shell = pkgs.nushell; hjem.users.${username} = { packages = with pkgs; [carapace nushell]; files = { @@ -96,11 +95,5 @@ in { ''; }; }; - - # needed for ghostty, as it runs as a systemd service (for faster startups) - systemd.user.services.ghosttyd.path = [ - pkgs.carapace - pkgs.zoxide - ]; }; } diff --git a/modules/programs/terminal/shell/zsh.nix b/modules/programs/terminal/shell/zsh.nix new file mode 100644 index 0000000..d589dcf --- /dev/null +++ b/modules/programs/terminal/shell/zsh.nix @@ -0,0 +1,51 @@ +{ + lib, + pkgs, + config, + ... +}: let + inherit (lib) mkIf; + inherit (config.local.systemVars) username; +in { + config = mkIf config.local.profiles.desktop.enable { + programs.zsh.enable = true; + hjem.users.${username} = { + packages = [pkgs.zsh]; + files = { + ".zshrc".text = '' + SAVEHIST=2000 + HISTSIZE=2000 + ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=cyan,underline" + ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) + + bindkey -v + + eval "$(starship init zsh)" + eval "$(zoxide init zsh)" + + source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh + + # aliases + alias lg='lazygit' + alias g='git' + alias gs='git status' + alias ga='git add' + alias gc='git commit' + alias gca='git commit --amend' + alias gcm='git commit --message' + alias gk='git checkout' + alias gd='git diff' + alias gf='git fetch' + alias gl='git log' + alias gp='git push' + alias gpf='git push --force-with-lease' + alias gr='git reset' + alias gt='git stash' + alias gtp='git stash pop' + alias gu='git pull' + ''; + }; + }; + }; +}