From 7793b7d8af601353e236252922abe84c5e9b79d0 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sat, 19 Mar 2022 16:56:48 -0600 Subject: home: improve shenv infra --- home/zshrc.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'home') diff --git a/home/zshrc.nix b/home/zshrc.nix index 39b34ff..85cdc95 100644 --- a/home/zshrc.nix +++ b/home/zshrc.nix @@ -43,8 +43,10 @@ INSTALLABLES=() while read -d: PATH_ITEM; do - if [[ "$PATH_ITEM" =~ "^/nix/store/[a-z0-9]+-([a-zA-Z][a-zA-Z0-9_]*(-[a-zA-Z][a-zA-Z0-9_]*)*)" ]]; then - INSTALLABLES+=("''${match[1]}") + if [[ "$PATH_ITEM" =~ "^(/nix/store/[a-z0-9]+-([a-zA-Z][a-zA-Z0-9_]*(-[a-zA-Z][a-zA-Z0-9_]*)*)(-[^/]+)?)/" ]]; then + ENTER="''${match[1]}/lib/shenv/enter" + [[ "''${match[2]}" =~ '^shenv-' && -r "$ENTER" ]] && . "$ENTER" + INSTALLABLES+=("''${match[2]}") fi done <<<"$PATH" @@ -52,7 +54,7 @@ _GRML_NIX_SHELL="{''${INSTALLABLES[@]}} " fi - unset INSTALLABLES PATH_ITEM + unset INSTALLABLES ENTER PATH_ITEM function grml_nix_shell() { REPLY="$_GRML_NIX_SHELL" -- cgit v1.2.3