From 04e2e47d76801558f96af136599d107c491d94bb Mon Sep 17 00:00:00 2001 From: Nico Date: Sat, 3 May 2025 16:15:56 +1000 Subject: [PATCH] zsh: added shell configurations --- nix/modules/shell.nix | 50 ++++++++++++++++++++++++++++++++++++ stow/.zshrc | 59 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 nix/modules/shell.nix create mode 100644 stow/.zshrc diff --git a/nix/modules/shell.nix b/nix/modules/shell.nix new file mode 100644 index 0000000..c0993ba --- /dev/null +++ b/nix/modules/shell.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs }: + +{ + programs.zsh.enable = true; + + environment.systemPackages = with pkgs; [ + git + tmux + tlrc + file + stow + btop + jq + fzf + killall + ripgrep + wget + + ffmpeg + imagemagick + ]; + + programs.direnv = { + enable = true; + silent = true; + loadInNixShell = true; + nix-direnv.enable = true; + + direnvrcExtra = '' + export PROMPT="* $PROMPT" + ''; + }; + + programs.neovim = { + enable = true; + vimAlias = true; + viAlias = true; + withRuby = true; + withPython3 = true; + withNodeJs = true; + }; + + neovim = pkgs.neovim.override { + nativeBuildInputs = with pkgs; [ + cargo + nodejs + go + ]; + }; +} diff --git a/stow/.zshrc b/stow/.zshrc new file mode 100644 index 0000000..47c7486 --- /dev/null +++ b/stow/.zshrc @@ -0,0 +1,59 @@ +# z shell configuration + +PROMPT="%F{green}%~ %F{yellow}%m %f" + +bindkey -e + +# hist +HISTFILE="$HOME/.local/share/zsh_hist" +SAVEHIST=10000000 +HISTSIZE=10000000 + +setopt hist_save_no_dups +setopt hist_ignore_all_dups +setopt hist_find_no_dups +setopt hist_ignore_space + +# shell alias +alias ls="ls -h --color=auto" +alias la="ls -ah --color=auto" +alias ll="ls -ahl --color=auto" + +# env vars +export GOPATH="$HOME/.local/share/go" +export PATH="$PATH:$GOPATH/bin" + +export EDITOR="nvim" + +# functions +func calc() { + # why isn't this in bash by default + # + if command -v python3 > /dev/null; then + python3 -c "print($1)" + else + echo "python3 needs to be installed for this to work!" + fi +} + +# plugins +plugindir="$HOME/.local/share/zsh_plug" +func plugInstall() { + # clones a repo and then sources it. + # first arg is git url, second is source + # location + + foldername=$(basename $1) + clonepath="$plugindir/$foldername" + sourcefile="$clonepath/$2" + + if command -v git > /dev/null && [ ! -d "$clonepath" ]; then + git clone $1 "$clonepath" + fi + + if [ -f "$sourcefile" ]; then + source "$sourcefile" + fi +} + +plugInstall https://github.com/zsh-users/zsh-syntax-highlighting zsh-syntax-highlighting.zsh