From 3eb747fd14be669f2a4dd96ec8c84bc2feba447c Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Thu, 13 Mar 2025 20:17:56 +0100 Subject: [PATCH] ns --- users/pbsds/home/profiles/bashrc.d/nix-shell.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/users/pbsds/home/profiles/bashrc.d/nix-shell.sh b/users/pbsds/home/profiles/bashrc.d/nix-shell.sh index a66a049..7afe779 100644 --- a/users/pbsds/home/profiles/bashrc.d/nix-shell.sh +++ b/users/pbsds/home/profiles/bashrc.d/nix-shell.sh @@ -32,8 +32,13 @@ _ns() { return $? fi - >&2 echo -n + - >&2 printf " %q" exec nix shell "${args[@]}" + # echo current shell + # >&2 echo -n + exec nix shell + >&2 echo -n + ns + if [[ -v _PREVIOUS_NS_ARGS ]]; then + >&2 echo -n " ${_PREVIOUS_NS_ARGS:-}" + fi + >&2 printf " %q" "${args[@]}" >&2 echo local outpaths="$( export NIXPKGS_ALLOW_BROKEN @@ -117,6 +122,12 @@ _ns() { # export PYTHONNOUSERSITE=1 fi done + + if [[ -v _PREVIOUS_NS_ARGS ]]; then + export _PREVIOUS_NS_ARGS="$_PREVIOUS_NS_ARGS$(printf " %q" "${args[@]}")" + else + export _PREVIOUS_NS_ARGS="$(printf " %q" "${args[@]}" | cut -c2-)" + fi } ns() { _ns false "$@"; }