From b2734b71e6c6e2d002a5c2e847721296b4d08df0 Mon Sep 17 00:00:00 2001 From: Jerry Starke <42114389+JerrySM64@users.noreply.github.com> Date: Fri, 9 Feb 2024 03:51:04 +0100 Subject: [PATCH] Add zsh as an option --- config/home/bash.nix | 7 +++-- config/home/default.nix | 1 + config/home/zsh.nix | 68 +++++++++++++++++++++++++++++++++++++++++ options.nix | 1 + 4 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 config/home/zsh.nix diff --git a/config/home/bash.nix b/config/home/bash.nix index 75f11b4..66ae898 100644 --- a/config/home/bash.nix +++ b/config/home/bash.nix @@ -1,7 +1,7 @@ -{ config, pkgs, ... }: +{ config, pkgs, username, ... }: -let inherit (import ../../options.nix) flakeDir; in -{ +let inherit (import ../../options.nix) flakeDir theShell; in +lib.mkIf (theShell == "bash") { # Configure Bash programs.bash = { enable = true; @@ -33,4 +33,5 @@ let inherit (import ../../options.nix) flakeDir; in ".."="cd .."; }; }; + users.users.${username}.shell = pkgs.bash; } diff --git a/config/home/default.nix b/config/home/default.nix index 5ee833f..5218c82 100644 --- a/config/home/default.nix +++ b/config/home/default.nix @@ -17,6 +17,7 @@ ./swappy.nix ./swaylock.nix ./swaync.nix + ./zsh.nix # Place Home Files Like Pictures ./files.nix diff --git a/config/home/zsh.nix b/config/home/zsh.nix new file mode 100644 index 0000000..14163f1 --- /dev/null +++ b/config/home/zsh.nix @@ -0,0 +1,68 @@ +{ config, pkgs, username, ... }: + +let inherit (import ../../options.nix) flakeDir theShell; in +lib.mkIf (theShell == "zsh") { + programs.zsh = { + enable = true; + syntaxHighlighting.enable = true; + autosuggestions = { + enable = true; + async = true; + highlightStyle = "fg=cyan"; + strategy = ["completion"]; + }; + ohMyZsh = { + enable = true; + plugins = ["history-substring-search"]; + }; + profileExtra = '' + #if [ -z "$DISPLAY" ] && [ "$XDG_VNTR" = 1 ]; then + # exec Hyprland + #fi + ''; + initExtra = '' + zstyle ":completion:*" menu select + zstyle ":completion:*" matcher-list "" "m:{a-z0A-Z}={A-Za-z}" "r:|=*" "l:|=* r:|=*" + if type nproc &>/dev/null; then + export MAKEFLAGS="$MAKEFLAGS -j$(($(nproc)-1))" + fi + bindkey '^[[3~' delete-char # Key Del + bindkey '^[[5~' beginning-of-buffer-or-history # Key Page Up + bindkey '^[[6~' end-of-buffer-or-history # Key Page Down + bindkey '^[[1;3D' backward-word # Key Alt + Left + bindkey '^[[1;3C' forward-word # Key Alt + Right + bindkey '^[[H' beginning-of-line # Key Home + bindkey '^[[F' end-of-line # Key End + neofetch + if [ -f $HOME/.zshrc-personal ]; then + source $HOME/.zshrc-personal + fi + eval "$(starship init zsh)" + ''; + initExtraFirst = '' + HISTFILE=~/.histfile + HISTSIZE=1000 + SAVEHIST=1000 + setopt autocd nomatch + unsetopt beep extendedglob notify + autoload -Uz compinit + compinit + ''; + sessionVariables = { + + }; + shellAliases = { + sv="sudo vim"; + flake-rebuild="sudo nixos-rebuild switch --flake ${flakeDir}"; + flake-update="sudo nix flake update ${flakeDir}"; + gcCleanup="nix-collect-garbage --delete-old && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot"; + v="nvim"; + ls="lsd"; + ll="lsd -l"; + la="lsd -a"; + lal="lsd -al"; + ".."="cd .."; + }; + }; + users.users.${username}.shell = pkgs.zsh; +} diff --git a/options.nix b/options.nix index 1202f8c..12742fc 100644 --- a/options.nix +++ b/options.nix @@ -24,6 +24,7 @@ in { theSecondKBDLayout = "pl"; theLCVariables = "en_US.UTF-8"; theTimezone = "America/Chicago"; + theShell = "bash"; # Possible options: bash, zsh cpuType = "intel"; gpuType = "amd";