diff --git a/home/lander/global/default.nix b/home/lander/global/default.nix index ba3381a..6c4f5cc 100644 --- a/home/lander/global/default.nix +++ b/home/lander/global/default.nix @@ -9,6 +9,7 @@ inputs.catppuccin.homeManagerModules.catppuccin ./git + ./zsh.nix ]; home = { diff --git a/home/lander/global/zsh.nix b/home/lander/global/zsh.nix new file mode 100644 index 0000000..1d93213 --- /dev/null +++ b/home/lander/global/zsh.nix @@ -0,0 +1,98 @@ +{ + programs = { + zsh = { + enable = true; + dotDir = ".config/zsh"; + + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting = { + enable = true; + catppuccin.enable = true; + }; + + history = { + save = 10000; + size = 10000; + path = "$HOME/.cache/zsh_history"; + }; + + initExtra = '' + bindkey '^[[1;5C' forward-word # Ctrl+RightArrow + bindkey '^[[1;5D' backward-word # Ctrl+LeftArrow + + zstyle ':completion:*' completer _complete _match _approximate + zstyle ':completion:*:match:*' original only + zstyle ':completion:*:approximate:*' max-errors 1 numeric + zstyle ':completion:*' menu select + zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" + + # HACK! Simple shell function to patch ruff bins downloaded by tox from PyPI to use + # the ruff included in NixOS - needs to be run each time the tox enviroment is + # recreated + patch_tox_ruff() { + for x in $(find .tox -name ruff -type f -print); do + rm $x; + ln -sf $(which ruff) $x; + done + } + + clean-crafts-lxc() { + for CRAFT in snapcraft rockcraft charmcraft; do + lxc --project $CRAFT list -fcsv -cn | xargs lxc --project $CRAFT delete -f >/dev/null + done + } + + export EDITOR=vim + ''; + + shellAliases = { + ls = "eza -gl --git --color=automatic"; + tree = "eza --tree"; + cat = "bat"; + + ip = "ip --color"; + ipb = "ip --color --brief"; + + gac = "git add -A && git commit -a"; + gp = "git push"; + gst = "git status -sb"; + + htop = "btm -b"; + neofetch = "fastfetch"; + + tf = "terraform"; + tfi = "terraform init"; + tfp = "terraform plan"; + tfa = "terraform apply -auto-approve"; + tfd = "terraform destroy -auto-approve"; + tfo = "terraform output -json"; + + wgu = "sudo wg-quick up"; + wgd = "sudo wg-quick down"; + + ts = "tailscale"; + tst = "tailscale status"; + tsu = "tailscale up --ssh --operator=$USER"; + tsd = "tailscale down"; + + js = "juju status"; + jsw = "juju status --watch 1s --color"; + jsrw = "juju status --watch 1s --color --relations"; + jdl = "juju debug-log"; + + open = "xdg-open"; + k = "kubectl"; + + opget = "op item get \"$(op item list --format=json | jq -r '.[].title' | fzf)\""; + + speedtest = "curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -"; + + cleanup-nix = "nh clean all --keep-since 10d --keep 3"; + rln = "nh os switch /home/lander/git/nixos-config"; + rlh = "nh home switch /home/lander/git/nixos-config"; + rlb = "rln;rlh"; + }; + }; + }; +}