From 664a158281b09b731e7d8f20068e5a6369ecb92d Mon Sep 17 00:00:00 2001 From: Ahwx Date: Sat, 26 Jul 2025 19:06:51 +0200 Subject: [PATCH] feat: adds nixcd function --- modules/home/zsh.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix index 8082e59..53e7fbb 100644 --- a/modules/home/zsh.nix +++ b/modules/home/zsh.nix @@ -110,6 +110,20 @@ printf "%s\n" "''${url}" } + function nixcd () { sakura + PACKAGE_NAME="$1" + if [[ "$PACKAGE_NAME" = "" ]]; then + echo "Usage: nixcd " + fi + PKGINSTORE="$(NIXPKGS_ALLOW_UNFREE=1 nix path-info nixpkgs#$PACKAGE_NAME --impure)" + if [[ -d "$PKGINSTORE" ]]; then + cd $PKGINSTORE + else + echo "Could not find path for package: $PKGINSTORE" + return 1 + fi + } + export export PATH="''${PATH}:''${HOME}/.local/bin/:''${HOME}/.cargo/bin/:''${HOME}/.fzf/bin/" # if [[ $(which sxiv&>/dev/null && echo 1) == "1" ]]; then