WSL starts sh scripts on startup that is able to expand env with profile. By default VScode WSL extension does not run shell in interactive mode and does not load anything from .rc files
I managed to do a workaround to enable Flox in VScode server using bash as a helper in ~/.vscode-server/server-env-setup
#!/bin/sh
set -eu
temp_file=$(mktemp)
temp_file2=$(mktemp)
/bin/bash --login -c 'flox activate > "'"$temp_file"'"'
grep "export\|rm" "$temp_file" > "$temp_file2"
. "$temp_file2"
rm "$temp_file" "$temp_file2"
#echo "Activated FLOX in VSCode Server" >&2
–login is not strictly necessary but grep is as mangling the PS seems to not work well after that. We just know that Flux is loaded.
As Bourne Shell does not support . <()
I had to use temp_file and this problem occurs:
$ flox activate > tmp
ERROR: unknown shell: /usr/bin/dash
It would be easier if sh would be directly supported. Or maybe it’s me doing something in non-supported way?