Keep PWD when switching into special env

This commit is contained in:
Fabian Hauser 2022-01-03 20:10:09 +01:00
parent 2bcc955f07
commit 6187ea8497

View file

@ -40,6 +40,7 @@ let
set -eo pipefail set -eo pipefail
# Nix shell might fail on some PWDs, so go to home # Nix shell might fail on some PWDs, so go to home
OLD_PWD=`pwd`
cd $HOME cd $HOME
ENV_NAME="$1" ENV_NAME="$1"
@ -57,7 +58,7 @@ let
fi fi
echo "Starting '$COMMAND' in env '$ENV_FILE'" echo "Starting '$COMMAND' in env '$ENV_FILE'"
${pkgs.nix}/bin/nix-shell ''${ENV_FILE} --run "$COMMAND" ${pkgs.nix}/bin/nix-shell ''${ENV_FILE} --run "(cd $OLD_PWD; $COMMAND)"
''; '';
wsudo = with pkgs.xorg; wsudo = with pkgs.xorg;