fix environment variable dump extraction

Grep does not work across multiple lines.
However the output of direnv is on a single anyway.
This commit is contained in:
Jörg Thalheim 2019-09-30 17:15:28 +01:00
parent d0dc1479ea
commit e7df598cd0
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4

View file

@ -17,9 +17,9 @@ use_nix() {
[[ shell.nix -nt "$cache" ]]; [[ shell.nix -nt "$cache" ]];
then then
[ -d .direnv ] || mkdir .direnv [ -d .direnv ] || mkdir .direnv
local dump_cmd="echo \<direnv\>; \"$direnv\" dump bash; echo \</direnv\>" local dump_cmd="echo -n _____direnv_____; \"$direnv\" dump bash"
local tmp=$(nix-shell --show-trace --pure "$@" \ local tmp=$(nix-shell --show-trace --pure "$@" \
--run "$dump_cmd" | grep -oP '(?<=<direnv>).*?(?=</direnv>)') --run "$dump_cmd" | grep -oP '(?<=_____direnv_____).*')
echo "$tmp" > "$cache" echo "$tmp" > "$cache"
update_drv=1 update_drv=1
else else