Why is it necessary to activate with `. <(flox activate)`?

I installed an executable, cmt, to both the default and the haskell environments. When I try to activate the haskell environment with just flox activate -e haskell, I don’t access its corresponding cmt executable:

○ which cmt
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin/cmt

○ flox activate -e haskell

○ which cmt
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin/cmt

○ . <(flox activate -e haskell)

○ which cmt
/Users/etorreborre/.local/share/flox/environments/etorreborre/haskell/bin/cmt

I am using zsh and I actually don’t know what . <(flox activate -e haskell) does differently than just flox activate -e haskell.

The topic of activation is discussed in the floxdocs Using Environments section, but in short:

  • when invoked from a controlling terminal (i.e. interactively), flox activate will start a subshell populated with all the necessary environment variables
  • when invoked without a controlling terminal (i.e. from a .zprofile as you first log in), flox activate will emit the commands required to populate the necessary environment variables using the appropriate commands for your shell language

If that doesn’t make sense, then perhaps this example will?

[brantley@clubsoda:~/src/flox-internal]$ flox activate -e testing | grep testing
export FLOX_PATH_PREPEND="/home/brantley/.local/share/flox/environments/limeytexan/testing/bin"
export FLOX_ACTIVE_ENVIRONMENTS="/home/brantley/.local/share/flox/environments/limeytexan/testing:/home/brantley/.local/share/flox/environments/limeytexan/default"
export FLOX_PROMPT_ENVIRONMENTS="testing default"

[brantley@clubsoda:~/src/flox-internal]$ flox activate -e testing 

flox [testing default] [brantley@clubsoda:~/src/flox-internal]$ env | grep testing
FLOX_PROMPT_ENVIRONMENTS=testing default
FLOX_ACTIVE_ENVIRONMENTS=/home/brantley/.local/share/flox/environments/limeytexan/testing:/home/brantley/.local/share/flox/environments/limeytexan/default
PATH=/home/brantley/.local/share/flox/environments/limeytexan/testing/bin:/home/brantley/.local/share/flox/environments/limeytexan/default/bin:/run/wrappers/bin:/home/brantley/.nix-profile/bin:/etc/profiles/per-user/brantley/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin

flox [testing default] [brantley@clubsoda:~/src/flox-internal]$ 

Let me know if that helps - thanks!

It is still not clear to me why, when I open a zsh session and type flox activate -e haskell I don’t see /Users/etorreborre/.local/share/flox/environments/etorreborre/haskell/bin: prepended to my PATH variable but I still see the default one.

The example in the subshell section seems to do exactly that:

$ flox activate -e work
[flox] $ which vim
/home/floxfan/.local/share/flox/environments/local/work/bin/vim

When I do something similar I get

○ echo $PATH
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin

~
○ flox activate -e haskell

~
○ echo $PATH
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin

Also I don’t understand why when executing . <(flox activate -e haskell) then my PATH variable magically gets prepended with the content of FLOX_PATH_PREPEND.

In terms of usability it is a bit problematic to me because it means that if I want to switch to an environment containing a specific executable I need to remember to use the longer form . <(flox activate -e env).

Finally I can see that a FLOX_PROMPT_ENVIRONMENTS variable is available. I guess that the idea is to use it to enrich the current prompt with the flox environments. I need to check how to do this with zsh :-).

For now I added this to my .zshrc file and it shows the current environment on the right of my screen:

RPROMPT='%F{green}${FLOX_PROMPT_ENVIRONMENTS%" default"}%f'

Sorry this isn’t working for you as expected. Can I just confirm you’re using the latest version? The example you show above has a prompt containing “[flox]” and the latest version does not do that.

Here’s the latest version on darwin:

flox  [default] brantley@Michaels-MBP flox-internal % flox upgrade flox.flox-prerelease
upgrading 'evalCatalog.aarch64-darwin.stable.flox-prerelease' from flake 'github:flox/floxpkgs/aa643781031957c0403f52a2aed718930f359dfc' to 'github:flox/floxpkgs/964b0e39ade4d0bb645ab64dae85197ab61d7b61'
flox  [default] brantley@Michaels-MBP flox-internal % flox --version
Version: 0.0.6-r58
flox  [default] brantley@Michaels-MBP flox-internal % 

(x86_64-darwin should be the same version)

Once you’re sure you’re using the latest version, please include the full output of flox -v activate -e haskell so we can see what it’s doing. I’m also happy to hop on Discord if this is easier to debug in real time.

Many thanks!

The example with [flox] is actually taken from the documentation :-).

Here is a full session with the latest flox

○ flox --version
Version: 0.0.6-r54

~
○ flox upgrade flox.flox-prerelease
copying path '/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58' from 'https://cache.floxdev.com'...
upgrading 'evalCatalog.x86_64-darwin.stable.flox-prerelease' from flake 'github:flox/floxpkgs/2b4bcb9d6c1b6cef4966a4716d8af3f296599f9a' to 'github:flox/floxpkgs/964b0e39ade4d0bb645ab64dae85197ab61d7b61'
this derivation will be built:
  /nix/store/b6l4jaq0jpfkwknzy7283c0q6igk1i0a-flox-prerelease-0.0.6-r58.drv
building '/nix/store/b6l4jaq0jpfkwknzy7283c0q6igk1i0a-flox-prerelease-0.0.6-r58.drv'...

~
○ flox --version
Version: 0.0.6-r58

~
○ echo $PATH
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin

~
○ flox activate -e haskell
flox [haskell default]
~
○ echo $PATH                                                                                                                                                                                                                                                                                                                                                        haskell
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
flox [haskell default]
~
○ flox -v activate -e haskell                                                                                                                                                                                                                                                                                                                                       haskell

ERROR: /Users/etorreborre/.local/share/flox/environments/etorreborre/haskell environment already active

flox [haskell default]
~
○ flox activate                                                                                                                                                                                                                                                                                                                                                     haskell
no new environments to activate (active environments: haskell default)
flox [haskell default]
~
○ flox -v activate -e haskell                                                                                                                                                                                                                                                                                                                                       haskell

ERROR: /Users/etorreborre/.local/share/flox/environments/etorreborre/haskell environment already active

flox [haskell default]
~
○ echo $PATH                                                                                                                                                                                                                                                                                                                                                        haskell
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
flox [haskell default]
~
○ exit                                                                                                                                                                                                                                                                                                                                                              haskell

~
○ flox -v activate -e haskell
+ /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/manifestTOML.jq -s --arg system x86_64-darwin --argjson verbose 1 --arg profileOwner etorreborre --arg profileName haskell --arg FLOX_PATH_PREPEND /Users/etorreborre/.local/share/flox/environments/etorreborre/haskell/bin --args -- bashInit
+ /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/manifestTOML.jq -s --arg system x86_64-darwin --argjson verbose 1 --arg profileOwner etorreborre --arg profileName haskell --arg FLOX_PATH_PREPEND /Users/etorreborre/.local/share/flox/environments/etorreborre/haskell/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin --args -- bashInit
+ export ZDOTDIR="/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir"
+ /bin/zsh
prepending "/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin" to $PATH
export SSL_CERT_FILE="/nix/store/1xarrj27g8kag7482ipiapn79yb84v3b-nss-cacert-3.83/etc/ssl/certs/ca-bundle.crt"
export NIX_SSL_CERT_FILE="/nix/store/1xarrj27g8kag7482ipiapn79yb84v3b-nss-cacert-3.83/etc/ssl/certs/ca-bundle.crt"
export NIX_COREFOUNDATION_RPATH="/nix/store/1xscydv49868c2vkv93q388b66ij7lcs-swift-corefoundation-unstable-2018-09-14/Library/Frameworks"
export PATH_LOCALE="/nix/store/3dhqhx99xlw64anpc5fhn66v9898gcbm-adv_cmds-119-locale/share/locale"
if [ -n "/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj" ]; then
    . "/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj"
fi
flox: setting etorreborre/haskell aliases
+ alias fah=". <(flox activate -e haskell)"
+ alias far=". <(flox activate -e rust)"
+ alias fas=". <(flox activate -e scala)"
+ alias ff="fzf --preview='bat {} --color=always'"
+ alias ll="exa -lahF"
+ alias ls="exa"
flox: invoking etorreborre/haskell "scmpuff_init" hook
/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj:16: failed to compile regex: repetition-operator operand invalid
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj:22> scmpuff init '--shell=sh'
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj:22> eval $'scmpuff_status() {\n  local scmpuff_env_char="e"\n\n  # Ensure shwordsplit is on for zsh\n  if [ -n "$ZSH_VERSION" ]; then setopt shwordsplit; fi;\n\n  # Run scmpuff status, store output\n  # (`local` needs to be on its own line otherwise exit code is swallowed!)\n  local cmd_output\n  cmd_output="$(/usr/bin/env scmpuff status --filelist $@)"\n\n  # if there was an error, exit prematurely, and pass along the exit code\n  # (STDOUT was swallowed but not STDERR, so user should still see error msg)\n  local es=$?\n  if [ $es -ne 0 ]; then\n    return $es\n  fi\n\n  # Fetch list of files (from first line of script output)\n  files="$(echo "$cmd_output" | head -n 1)"\n\n  # Export numbered env variables for each file\n  scmpuff_clear_vars\n  IFS=$\'\\t\'\n  local e=1\n  for file in $files; do\n    export $scmpuff_env_char$e="$file"\n    let e++\n  done\n  IFS=$\' \\t\\n\'\n\n  # Print status (from line two onward)\n  echo "$cmd_output" | tail -n +2\n\n  # Reset zsh environment to default\n  if [ -n "$ZSH_VERSION" ]; then unsetopt shwordsplit; fi;\n}\n\n\n# Clear numbered env variables\nscmpuff_clear_vars() {\n  local scmpuff_env_char="e"\n  local i\n\n  for (( i=1; i<=999; i++ )); do\n    local env_var_i=${scmpuff_env_char}${i}\n    if [[ -n ${env_var_i} ]]; then\n      unset ${env_var_i}\n    else\n      break\n    fi\n  done\n}\n\n# Remove any existing git alias or function\nunalias git > /dev/null 2>&1\nunset -f git > /dev/null 2>&1\n\n# Use the full path to git to avoid infinite loop with git function\nSCMPUFF_GIT_CMD=${SCMPUFF_GIT_CMD:-"$(\\which git)"}\nexport SCMPUFF_GIT_CMD\n\nfunction git() {\n  case $1 in\n    commit|blame|log|rebase|merge)\n      scmpuff exec -- "$SCMPUFF_GIT_CMD" "$@";;\n    checkout|diff|rm|reset|restore)\n      scmpuff exec --relative -- "$SCMPUFF_GIT_CMD" "$@";;\n    add)\n      scmpuff exec -- "$SCMPUFF_GIT_CMD" "$@"\n      scmpuff_status;;\n    *)\n      "$SCMPUFF_GIT_CMD" "$@";;\n  esac\n}\n\nalias gs=\'scmpuff_status\'\nalias ga=\'git add\'\nalias gd=\'git diff\'\nalias gl=\'git log\'\nalias gco=\'git checkout\'\nalias grs=\'git reset\''
+(eval):56> unalias git
+(eval):57> unset -f git
+(eval):60> SCMPUFF_GIT_CMD=/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin/git
+(eval):61> export SCMPUFF_GIT_CMD
+(eval):77> alias 'gs=scmpuff_status'
+(eval):78> alias 'ga=git add'
+(eval):79> alias 'gd=git diff'
+(eval):80> alias 'gl=git log'
+(eval):81> alias 'gco=git checkout'
+(eval):82> alias 'grs=git reset'
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj:24> 'set +x'
/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj:24: command not found: set +x
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj:25> /nix/store/6jvr5f0amb2dsjw6gmb620pwyiyywp27-coreutils-9.1/bin/rm /var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.8OTBLqkZvj
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.profile:32> unset FLOX_PATH_PREPEND FLOX_ACTIVATE_VERBOSE FLOX_BASH_INIT_SCRIPT
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:24> [ -z '' ']'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:25> _floxPrompt1='%F{61}flox'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:26> _floxPrompt2='%F{216}[haskell default]'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:27> _flox='%B%F{61}flox %F{216}[haskell default]%f%b '
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:30> [ -n '%B%F{61}flox %F{216}[haskell default]%f%b ' -a -n $'\n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) ' ']'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:32> case
%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char)  (*\\n*)
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:32> case
%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char)  (*\\012*)
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:32> case
%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char)  (*)
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:40> PS1=$'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:46> unset _flox _floxPrompt1 _floxPrompt2
+precmd:1> echo -ne '\033]0;etorreborre\007'
+omz_termsupport_precmd:1> emulate -L zsh
+omz_termsupport_precmd:3> [[ '' == true ]]
+omz_termsupport_precmd:7> title '%15<..<%~%<<' '%n@%m: %~'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%n@%m: %~'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%n@%m:\ %~\a'
+title:13> print -Pn '\e]1;%15\<..\<%~%\<\<\a'
+_z_precmd:1> _z --add /Users/etorreborre
+_z:2> local datafile=/Users/etorreborre/.z
+iterm2_precmd:1> local STATUS=0
+iterm2_precmd:2> [ -z 1 ']'
+_z:5> [ -h /Users/etorreborre/.z ']'
+iterm2_precmd:7> iterm2_after_cmd_executes 0
+_z:8> [ -z '' -a -f /Users/etorreborre/.z -a '!' -O /Users/etorreborre/.z ']'
+iterm2_after_cmd_executes:1> printf '\033]133;D;%s\007' 0
+iterm2_after_cmd_executes:2> iterm2_print_state_data
+_z:20> [ --add '=' --add ']'
+iterm2_print_state_data:1> printf '\033]1337;RemoteHost=%s@%s\007' etorreborre sym
+_z:21> shift
+iterm2_print_state_data:2> printf '\033]1337;CurrentDir=%s\007' /Users/etorreborre
+iterm2_print_state_data:3> iterm2_print_user_vars
+_z:24> [ /Users/etorreborre '=' /Users/etorreborre ']'
+_z:24> return
+iterm2_print_user_vars:1> git branch --no-color
+iterm2_print_user_vars:1> grep '--color=auto' '--exclude-dir=.bzr' '--exclude-dir=CVS' '--exclude-dir=.git' '--exclude-dir=.hg' '--exclude-dir=.svn' '*'
+iterm2_print_user_vars:1> cut -c3-
+iterm2_print_user_vars:1> iterm2_set_user_var gitBranch
+iterm2_set_user_var:1> printf %s ''
+iterm2_set_user_var:1> base64
+iterm2_set_user_var:1> tr -d '\n'
+iterm2_set_user_var:1> printf '\033]1337;SetUserVar=%s=%s\007' gitBranch
+iterm2_precmd:9> [ -n 1 ']'
+iterm2_precmd:10> iterm2_decorate_prompt
+iterm2_decorate_prompt:3> ITERM2_PRECMD_PS1=$'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+iterm2_decorate_prompt:4> ITERM2_SHOULD_DECORATE_PROMPT=''
+iterm2_decorate_prompt:7> [[ $'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) ' == *\$\(iterm2_prompt_mark\)* ]]
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_mark
+iterm2_prompt_mark:1> printf '\033]133;A\007'
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_end
+iterm2_prompt_end:1> printf '\033]133;B\007'
+iterm2_decorate_prompt:11> PS1=$'%{\C-[]133;A\C-G%}%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) %{\C-[]133;B\C-G%}'
+/bin/zsh:1> collapse_pwd
+collapse_pwd:1> pwd
+collapse_pwd:1> sed -e 's,^/Users/etorreborre,~,'
+collapse_pwd:1> echo '~'
+/bin/zsh:1> hg_prompt_info
+hg_prompt_info:1> hg prompt --angle-brackets $'< on %{\C-[[35m%}<branch>%{\C-[[00m%}>< at %{\C-[[33m%}<tags|%{\C-[[00m%}, %{\C-[[33m%}>%{\C-[[00m%}>%{\C-[[32m%}<status|modified|unknown><update>%{\C-[[00m%}<\npatches: <patches|join( → )|pre_applied(%{\C-[[33m%})|post_applied(%{\C-[[00m%})|pre_unapplied(%{\C-[[01;30m%})|post_unapplied(%{\C-[[00m%})>>'
+/bin/zsh:1> git_prompt_info
+git_prompt_info:1> local ref
+git_prompt_info:2> [[+git_prompt_info:2> git config --get oh-my-zsh.hide-status
+git_prompt_info:2> [[ '' != 1 ]]
+git_prompt_info:3> ref=+git_prompt_info:3> git symbolic-ref HEAD
+git_prompt_info:3> ref=''
+git_prompt_info:4> ref=+git_prompt_info:4> git rev-parse --short HEAD
+git_prompt_info:4> ref=''
+git_prompt_info:4> return 0
+/bin/zsh:1> virtualenv_info
+virtualenv_info:1> [ ']'
+/bin/zsh:1> prompt_char
+prompt_char:1> git branch
+prompt_char:2> hg root
+prompt_char:3> echo ○
flox [haskell default]
~
○ echo $PATH                                                                                                                                                                                                                                                                                                                                                        haskell
+omz_termsupport_preexec:1> emulate -L zsh
+omz_termsupport_preexec:2> setopt extended_glob
+omz_termsupport_preexec:4> [[ '' == true ]]
+omz_termsupport_preexec:9> local CMD=echo
+omz_termsupport_preexec:10> local LINE='echo $PATH'
+omz_termsupport_preexec:12> title '$CMD' '%100>...>$LINE%<<'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%100>...>$LINE%<<'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%100\>...\>\$LINE%\<\<\a'
+title:13> print -Pn '\e]1;\$CMD\a'
+iterm2_preexec:2> PS1=$'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+iterm2_preexec:3> ITERM2_SHOULD_DECORATE_PROMPT=1
+iterm2_preexec:4> iterm2_before_cmd_executes
+iterm2_before_cmd_executes:1> printf '\033]133;C;\007'
+/bin/zsh:1> echo /Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
+precmd:1> echo -ne '\033]0;etorreborre\007'
+omz_termsupport_precmd:1> emulate -L zsh
+omz_termsupport_precmd:3> [[ '' == true ]]
+omz_termsupport_precmd:7> title '%15<..<%~%<<' '%n@%m: %~'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%n@%m: %~'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%n@%m:\ %~\a'
+title:13> print -Pn '\e]1;%15\<..\<%~%\<\<\a'
+_z_precmd:1> _z --add /Users/etorreborre
+iterm2_precmd:1> local STATUS=0
+_z:2> local datafile=/Users/etorreborre/.z
+iterm2_precmd:2> [ -z 1 ']'
+_z:5> [ -h /Users/etorreborre/.z ']'
+iterm2_precmd:7> iterm2_after_cmd_executes 0
+iterm2_after_cmd_executes:1> printf '\033]133;D;%s\007' 0
+iterm2_after_cmd_executes:2> iterm2_print_state_data
+_z:8> [ -z '' -a -f /Users/etorreborre/.z -a '!' -O /Users/etorreborre/.z ']'
+iterm2_print_state_data:1> printf '\033]1337;RemoteHost=%s@%s\007' etorreborre sym
+iterm2_print_state_data:2> printf '\033]1337;CurrentDir=%s\007' /Users/etorreborre
+_z:20> [ --add '=' --add ']'
+iterm2_print_state_data:3> iterm2_print_user_vars
+_z:21> shift
+_z:24> [ /Users/etorreborre '=' /Users/etorreborre ']'
+_z:24> return
+iterm2_print_user_vars:1> git branch --no-color
+iterm2_print_user_vars:1> grep '--color=auto' '--exclude-dir=.bzr' '--exclude-dir=CVS' '--exclude-dir=.git' '--exclude-dir=.hg' '--exclude-dir=.svn' '*'
+iterm2_print_user_vars:1> cut -c3-
+iterm2_print_user_vars:1> iterm2_set_user_var gitBranch
+iterm2_set_user_var:1> printf %s ''
+iterm2_set_user_var:1> base64
+iterm2_set_user_var:1> tr -d '\n'
+iterm2_set_user_var:1> printf '\033]1337;SetUserVar=%s=%s\007' gitBranch
+iterm2_precmd:9> [ -n 1 ']'
+iterm2_precmd:10> iterm2_decorate_prompt
+iterm2_decorate_prompt:3> ITERM2_PRECMD_PS1=$'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+iterm2_decorate_prompt:4> ITERM2_SHOULD_DECORATE_PROMPT=''
+iterm2_decorate_prompt:7> [[ $'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) ' == *\$\(iterm2_prompt_mark\)* ]]
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_mark
+iterm2_prompt_mark:1> printf '\033]133;A\007'
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_end
+iterm2_prompt_end:1> printf '\033]133;B\007'
+iterm2_decorate_prompt:11> PS1=$'%{\C-[]133;A\C-G%}%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) %{\C-[]133;B\C-G%}'
+/bin/zsh:2> collapse_pwd
+collapse_pwd:1> pwd
+collapse_pwd:1> sed -e 's,^/Users/etorreborre,~,'
+collapse_pwd:1> echo '~'
+/bin/zsh:2> hg_prompt_info
+hg_prompt_info:1> hg prompt --angle-brackets $'< on %{\C-[[35m%}<branch>%{\C-[[00m%}>< at %{\C-[[33m%}<tags|%{\C-[[00m%}, %{\C-[[33m%}>%{\C-[[00m%}>%{\C-[[32m%}<status|modified|unknown><update>%{\C-[[00m%}<\npatches: <patches|join( → )|pre_applied(%{\C-[[33m%})|post_applied(%{\C-[[00m%})|pre_unapplied(%{\C-[[01;30m%})|post_unapplied(%{\C-[[00m%})>>'
+/bin/zsh:2> git_prompt_info
+git_prompt_info:1> local ref
+git_prompt_info:2> [[+git_prompt_info:2> git config --get oh-my-zsh.hide-status
+git_prompt_info:2> [[ '' != 1 ]]
+git_prompt_info:3> ref=+git_prompt_info:3> git symbolic-ref HEAD
+git_prompt_info:3> ref=''
+git_prompt_info:4> ref=+git_prompt_info:4> git rev-parse --short HEAD
+git_prompt_info:4> ref=''
+git_prompt_info:4> return 0
+/bin/zsh:2> virtualenv_info
+virtualenv_info:1> [ ']'
+/bin/zsh:2> prompt_char
+prompt_char:1> git branch
+prompt_char:2> hg root
+prompt_char:3> echo ○
flox [haskell default]
○ flox list -e haskell                                                                                                                                                                                                                                                                                                                                              haskell
+omz_termsupport_preexec:1> emulate -L zsh
+omz_termsupport_preexec:2> setopt extended_glob
+omz_termsupport_preexec:4> [[ '' == true ]]
+omz_termsupport_preexec:9> local CMD=flox
+omz_termsupport_preexec:10> local LINE='flox list -e haskell'
+omz_termsupport_preexec:12> title '$CMD' '%100>...>$LINE%<<'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%100>...>$LINE%<<'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%100\>...\>\$LINE%\<\<\a'
+title:13> print -Pn '\e]1;\$CMD\a'
+iterm2_preexec:2> PS1=$'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+iterm2_preexec:3> ITERM2_SHOULD_DECORATE_PROMPT=1
+iterm2_preexec:4> iterm2_before_cmd_executes
+iterm2_before_cmd_executes:1> printf '\033]133;C;\007'
+/bin/zsh:3> flox list -e haskell
etorreborre/haskell
    Alias     haskell
    System    x86_64-darwin
    Path      /Users/etorreborre/.local/share/flox/environments/etorreborre/haskell
    Curr Gen  10

Packages
    0 stable.nixpkgs-flox.cabal2nix
    1 stable.nixpkgs-flox.cabal-install
    2 stable.nixpkgs-flox.hpack
    3 stable.nixpkgs-flox.ormolu
    4 stable.nixpkgs-flox.haskell-language-server
    5 stable.nixpkgs-flox.ghc
+precmd:1> echo -ne '\033]0;etorreborre\007'
+omz_termsupport_precmd:1> emulate -L zsh
+omz_termsupport_precmd:3> [[ '' == true ]]
+omz_termsupport_precmd:7> title '%15<..<%~%<<' '%n@%m: %~'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%n@%m: %~'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%n@%m:\ %~\a'
+title:13> print -Pn '\e]1;%15\<..\<%~%\<\<\a'
+_z_precmd:1> _z --add /Users/etorreborre
+_z:2> local datafile=/Users/etorreborre/.z
+iterm2_precmd:1> local STATUS=0
+_z:5> [ -h /Users/etorreborre/.z ']'
+iterm2_precmd:2> [ -z 1 ']'
+iterm2_precmd:7> iterm2_after_cmd_executes 0
+_z:8> [ -z '' -a -f /Users/etorreborre/.z -a '!' -O /Users/etorreborre/.z ']'
+iterm2_after_cmd_executes:1> printf '\033]133;D;%s\007' 0
+iterm2_after_cmd_executes:2> iterm2_print_state_data
+_z:20> [ --add '=' --add ']'
+iterm2_print_state_data:1> printf '\033]1337;RemoteHost=%s@%s\007' etorreborre sym
+_z:21> shift
+iterm2_print_state_data:2> printf '\033]1337;CurrentDir=%s\007' /Users/etorreborre
+iterm2_print_state_data:3> iterm2_print_user_vars
+_z:24> [ /Users/etorreborre '=' /Users/etorreborre ']'
+_z:24> return
+iterm2_print_user_vars:1> git branch --no-color
+iterm2_print_user_vars:1> grep '--color=auto' '--exclude-dir=.bzr' '--exclude-dir=CVS' '--exclude-dir=.git' '--exclude-dir=.hg' '--exclude-dir=.svn' '*'
+iterm2_print_user_vars:1> cut -c3-
+iterm2_print_user_vars:1> iterm2_set_user_var gitBranch
+iterm2_set_user_var:1> printf %s ''
+iterm2_set_user_var:1> base64
+iterm2_set_user_var:1> tr -d '\n'
+iterm2_set_user_var:1> printf '\033]1337;SetUserVar=%s=%s\007' gitBranch
+iterm2_precmd:9> [ -n 1 ']'
+iterm2_precmd:10> iterm2_decorate_prompt
+iterm2_decorate_prompt:3> ITERM2_PRECMD_PS1=$'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+iterm2_decorate_prompt:4> ITERM2_SHOULD_DECORATE_PROMPT=''
+iterm2_decorate_prompt:7> [[ $'%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) ' == *\$\(iterm2_prompt_mark\)* ]]
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_mark
+iterm2_prompt_mark:1> printf '\033]133;A\007'
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_end
+iterm2_prompt_end:1> printf '\033]133;B\007'
+iterm2_decorate_prompt:11> PS1=$'%{\C-[]133;A\C-G%}%B%F{61}flox %F{216}[haskell default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) %{\C-[]133;B\C-G%}'
+/bin/zsh:4> collapse_pwd
+collapse_pwd:1> pwd
+collapse_pwd:1> sed -e 's,^/Users/etorreborre,~,'
+collapse_pwd:1> echo '~'
+/bin/zsh:4> hg_prompt_info
+hg_prompt_info:1> hg prompt --angle-brackets $'< on %{\C-[[35m%}<branch>%{\C-[[00m%}>< at %{\C-[[33m%}<tags|%{\C-[[00m%}, %{\C-[[33m%}>%{\C-[[00m%}>%{\C-[[32m%}<status|modified|unknown><update>%{\C-[[00m%}<\npatches: <patches|join( → )|pre_applied(%{\C-[[33m%})|post_applied(%{\C-[[00m%})|pre_unapplied(%{\C-[[01;30m%})|post_unapplied(%{\C-[[00m%})>>'
+/bin/zsh:4> git_prompt_info
+git_prompt_info:1> local ref
+git_prompt_info:2> [[+git_prompt_info:2> git config --get oh-my-zsh.hide-status
+git_prompt_info:2> [[ '' != 1 ]]
+git_prompt_info:3> ref=+git_prompt_info:3> git symbolic-ref HEAD
+git_prompt_info:3> ref=''
+git_prompt_info:4> ref=+git_prompt_info:4> git rev-parse --short HEAD
+git_prompt_info:4> ref=''
+git_prompt_info:4> return 0
+/bin/zsh:4> virtualenv_info
+virtualenv_info:1> [ ']'
+/bin/zsh:4> prompt_char
+prompt_char:1> git branch
+prompt_char:2> hg root
+prompt_char:3> echo ○
flox [haskell default]
~
○ which hpack                                                                                                                                                                                                                                                                                                                                                       haskell
+omz_termsupport_preexec:1> emulate -L zsh
+omz_termsupport_preexec:2> setopt extended_glob
...
+/bin/zsh:4> which hpack
/Users/etorreborre/.local/bin/hpack
+precmd:1> echo -ne '\033]0;etorreborre\007'
...
+prompt_char:3> echo ○
flox [haskell default]

In that session I:

  • upgrade flox
  • print the PATH
  • activate the haskell environment
  • notice that there is now a prompt with the list of active environments :slight_smile:
  • print the PATH, the haskell/bin path does not come first
  • try to go back to default, eventually calling exit as I should
  • reactivate -e haskell with -v
  • try to echo $PATH → the verbose output is still on, something to fix for you :slight_smile:
  • check that an executable, hpack, is listed under the haskell environment
  • do a which hpack and realize it is found under /Users/etorreborre/.local/bin/hpack

By the way, in case you don’t know about that, I was surprised to learn that zsh was caching the path to some executables. So sometimes it can appear that zsh does not find the first executable on the PATH: zsh - Under what circumstances will the executable first found in the path not be used - Unix & Linux Stack Exchange.

This is a common problem with various environment managers. For example, python does this bit here: venv: Suppress warning message when bash hashing is disabled. by d-goldin · Pull Request #17966 · python/cpython · GitHub

Perhaps we automatically add that to all activations, for the same reason.

1 Like

@etorreborre - just double checking to see if we’ve missed any outstanding questions with this thread?

Hi Robin,

Thanks for checking. I think I still have an issue. Consider this session

○ which flox
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin/flox

~
○ flox --version
Version: 0.0.6-r58

~
○ echo $PATH
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin

~
○ flox activate -e rust
flox [rust default]
~
○ echo $PATH                                                                                                                                                                                                                                                               rust
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
flox [rust default]
~
○ . <(flox activate -e rust)                                                                                                                                                                                                                                               rust
flox [rust default]
~
○ echo $PATH                                                                                                                                                                                                                                                               rust
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
flox [rust default]
~

My PATH doesn’t seem to be properly updated. Maybe I don’t have the latest flox version?
I tried:

○ flox upgrade flox.flox-prerelease                                                                                                                                                                                                                                        rust
upgrading 'evalCatalog.x86_64-darwin.stable.flox-prerelease' from flake 'github:flox/floxpkgs/259fe47b83a7ac6efdb8c3a6d58eda9d59f819a8' to 'github:flox/floxpkgs/67bd56292db9874a3774baf6aeffd0f00515f769'
flox [rust default]
~
○ which flox                                                                                                                                                                                                                                                               rust
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin/flox
flox [rust default]
~
○ flox --version                                                                                                                                                                                                                                                           rust
Version: 0.0.6-r58

But maybe something else in my set-up is incorrect. I have . <(flox activate) in my .zshrc.
If I comment it out, here is a bunch of sessions giving me various results:

Session 1

○ flox --version
Version: 0.0.6-r52

~
○ flox activate -e rust
/dev/fd/63: line 7: scmpuff: command not found
[flox]
~
○ echo $PATH
/Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
[flox]

Session 2

~
○ flox --version
Version: 0.0.6-r52

~
○ . <(flox activate -e rust)

~
○ echo $PATH
/Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin

Session 3

○ flox activate
/dev/fd/63: line 7: scmpuff: command not found
[flox]
~
○ flox --version
Version: 0.0.6-r58
[flox]
~
○ echo $PATH
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
[flox]
~
○ flox activate -e rust
flox [rust default]
~
○ echo $PATH                                                                                                                                                                                                                                                               rust
/Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
flox [rust default]
~

Session 4

○ . <(flox activate)

~
○ flox --version
Version: 0.0.6-r58

~
○ flox activate -e rust
flox [rust default]
~
○ echo $PATH                                                                                                                                                                                                                                                               rust
/Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
flox [rust default]
~

Session 5

○ . <(flox activate)

~
○ flox --version
Version: 0.0.6-r58

~
○ . <(flox activate -e rust)

~
○ echo $PATH                                                                                                                                                                                                                                                               rust
/Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin

~
○

Right now I am still a bit confused about what is the right set-up with .zshrc and what is the right command to use. Ideally I would:

  • add a line in .zshrc to put me in the default environment
  • run flox activate -e rust to select the rust environment
  • check my PATH and see that rust/bin comes first

Yes - that’s the idea and absolutely correct. If I can ask one further favour could you do the following:

  1. Compare the behaviour of flox activate -e rust (interactive) vs. . <(flox activate -e rust) (non-interactive). Are they both broken in the same way?
  2. Whichever one(s) of the above are broken, can you add the --debug flag and send me the output? E.g. . <(flox --debug activate -e rust)

I’ll be online later today if you would like to work on this in real time. As ever, many thanks for the feedback!

Here is the first session, that is broken (I put back the . <(flox activate) command in my .zshrc

○ flox --debug activate -e rust
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:139 hash_commands( ansifilter awk basename bash cat chmod cmp column cp curl cut dasel date dirname id jq getent gh git gum grep ln man mkdir mktemp mv nix nix-store parallel pwd readlink realpath rm rmdir sed sh sleep sort stat tail touch tr uuid xargs zgrep )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:158 first_in_PATH( vim vi nano emacs ed )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:65 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get floxClientUUID )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get floxClientUUID )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:67 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get floxClientUUID )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get floxClientUUID )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:70 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get gitBaseURL )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get gitBaseURL )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:74 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get organization )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get organization )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:78 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get defaultFlake )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get defaultFlake )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:88 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 set defaultFlake github:flox/floxpkgs/master )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:470 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- set defaultFlake github:flox/floxpkgs/master )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:96 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get defaultSubstituter )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get defaultSubstituter )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/bootstrap.sh:107 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get floxMetricsConsent )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get floxMetricsConsent )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:889 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 set channels flox github:flox/floxpkgs/master )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:470 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- set channels flox github:flox/floxpkgs/master )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:890 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 set channels nixpkgs github:flox/nixpkgs/stable )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:470 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- set channels nixpkgs github:flox/nixpkgs/stable )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:891 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 set channels nixpkgs-flox github:flox/nixpkgs-flox/master )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:470 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- set channels nixpkgs-flox github:flox/nixpkgs-flox/master )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:900 registry( /Users/etorreborre/.config/flox/floxUserMeta.json 1 get channels )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:484 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -n -e -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/registry.jq --arg version 1 --slurpfile registry /Users/etorreborre/.config/flox/floxUserMeta.json --args -- get channels )
trace:/dev/fd/63:1 invoke( /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/nix registry add --registry /Users/etorreborre/.config/flox/tmp.knwboiogCH etorreborre github:etorreborre/floxpkgs/main )
trace:/dev/fd/63:2 invoke( /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/nix registry add --registry /Users/etorreborre/.config/flox/tmp.knwboiogCH flox github:flox/floxpkgs/master )
trace:/dev/fd/63:3 invoke( /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/nix registry add --registry /Users/etorreborre/.config/flox/tmp.knwboiogCH nixpkgs github:flox/nixpkgs/stable )
trace:/dev/fd/63:4 invoke( /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/nix registry add --registry /Users/etorreborre/.config/flox/tmp.knwboiogCH nixpkgs-flox github:flox/nixpkgs-flox/master )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:905 invoke( /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/nix registry add --registry /Users/etorreborre/.config/flox/tmp.knwboiogCH nixpkgs-stable github:flox/nixpkgs/stable )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:906 invoke( /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/nix registry add --registry /Users/etorreborre/.config/flox/tmp.knwboiogCH nixpkgs-staging github:flox/nixpkgs/staging )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:907 invoke( /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/nix registry add --registry /Users/etorreborre/.config/flox/tmp.knwboiogCH nixpkgs-unstable github:flox/nixpkgs/unstable )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:124 submitMetric( activate )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:139 profileArg( rust )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:148 profileArg( default )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:162 profileGen( /Users/etorreborre/.local/share/flox/environments/etorreborre/rust )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:228 manifestTOML( bashInit )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:346 invoke( /nix/store/bhksfy18cry2f5i90lkccn1jd69wqg2g-dasel-1.27.3/bin/dasel -f - -r toml -w json )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:346 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/manifestTOML.jq -s --arg system x86_64-darwin --argjson verbose 1 --arg profileOwner etorreborre --arg profileName rust --arg FLOX_PATH_PREPEND /Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin --args -- bashInit )
+ /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/manifestTOML.jq -s --arg system x86_64-darwin --argjson verbose 1 --arg profileOwner etorreborre --arg profileName rust --arg FLOX_PATH_PREPEND /Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin --args -- bashInit
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:228 manifestTOML( bashInit )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:346 invoke( /nix/store/bhksfy18cry2f5i90lkccn1jd69wqg2g-dasel-1.27.3/bin/dasel -f - -r toml -w json )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:346 invoke( /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/manifestTOML.jq -s --arg system x86_64-darwin --argjson verbose 1 --arg profileOwner etorreborre --arg profileName rust --arg FLOX_PATH_PREPEND /Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin --args -- bashInit )
+ /nix/store/psgcq0br49h5pgnc4pzmpz88fspzx48w-jq-1.6-bin/bin/jq -r -f /nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/manifestTOML.jq -s --arg system x86_64-darwin --argjson verbose 1 --arg profileOwner etorreborre --arg profileName rust --arg FLOX_PATH_PREPEND /Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin --args -- bashInit
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:310 warn( '+ export ZDOTDIR="/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir"' )
+ export ZDOTDIR="/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir"
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/libexec/flox/flox:751 invoke( /bin/zsh )
+ /bin/zsh
prepending "/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin" to $PATH
export SSL_CERT_FILE="/nix/store/1xarrj27g8kag7482ipiapn79yb84v3b-nss-cacert-3.83/etc/ssl/certs/ca-bundle.crt"
export NIX_SSL_CERT_FILE="/nix/store/1xarrj27g8kag7482ipiapn79yb84v3b-nss-cacert-3.83/etc/ssl/certs/ca-bundle.crt"
export NIX_COREFOUNDATION_RPATH="/nix/store/1xscydv49868c2vkv93q388b66ij7lcs-swift-corefoundation-unstable-2018-09-14/Library/Frameworks"
export PATH_LOCALE="/nix/store/3dhqhx99xlw64anpc5fhn66v9898gcbm-adv_cmds-119-locale/share/locale"
if [ -n "/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn" ]; then
    . "/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn"
fi
flox: setting etorreborre/rust aliases
+ alias fah=". <(flox activate -e haskell)"
+ alias far=". <(flox activate -e rust)"
+ alias fas=". <(flox activate -e scala)"
+ alias ff="fzf --preview='bat {} --color=always'"
+ alias ll="exa -lahF"
+ alias ls="exa"
flox: invoking etorreborre/rust "scmpuff_init" hook
/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn:16: failed to compile regex: repetition-operator operand invalid
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn:22> scmpuff init '--shell=sh'
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn:22> eval $'scmpuff_status() {\n  local scmpuff_env_char="e"\n\n  # Ensure shwordsplit is on for zsh\n  if [ -n "$ZSH_VERSION" ]; then setopt shwordsplit; fi;\n\n  # Run scmpuff status, store output\n  # (`local` needs to be on its own line otherwise exit code is swallowed!)\n  local cmd_output\n  cmd_output="$(/usr/bin/env scmpuff status --filelist $@)"\n\n  # if there was an error, exit prematurely, and pass along the exit code\n  # (STDOUT was swallowed but not STDERR, so user should still see error msg)\n  local es=$?\n  if [ $es -ne 0 ]; then\n    return $es\n  fi\n\n  # Fetch list of files (from first line of script output)\n  files="$(echo "$cmd_output" | head -n 1)"\n\n  # Export numbered env variables for each file\n  scmpuff_clear_vars\n  IFS=$\'\\t\'\n  local e=1\n  for file in $files; do\n    export $scmpuff_env_char$e="$file"\n    let e++\n  done\n  IFS=$\' \\t\\n\'\n\n  # Print status (from line two onward)\n  echo "$cmd_output" | tail -n +2\n\n  # Reset zsh environment to default\n  if [ -n "$ZSH_VERSION" ]; then unsetopt shwordsplit; fi;\n}\n\n\n# Clear numbered env variables\nscmpuff_clear_vars() {\n  local scmpuff_env_char="e"\n  local i\n\n  for (( i=1; i<=999; i++ )); do\n    local env_var_i=${scmpuff_env_char}${i}\n    if [[ -n ${env_var_i} ]]; then\n      unset ${env_var_i}\n    else\n      break\n    fi\n  done\n}\n\n# Remove any existing git alias or function\nunalias git > /dev/null 2>&1\nunset -f git > /dev/null 2>&1\n\n# Use the full path to git to avoid infinite loop with git function\nSCMPUFF_GIT_CMD=${SCMPUFF_GIT_CMD:-"$(\\which git)"}\nexport SCMPUFF_GIT_CMD\n\nfunction git() {\n  case $1 in\n    commit|blame|log|rebase|merge)\n      scmpuff exec -- "$SCMPUFF_GIT_CMD" "$@";;\n    checkout|diff|rm|reset|restore)\n      scmpuff exec --relative -- "$SCMPUFF_GIT_CMD" "$@";;\n    add)\n      scmpuff exec -- "$SCMPUFF_GIT_CMD" "$@"\n      scmpuff_status;;\n    *)\n      "$SCMPUFF_GIT_CMD" "$@";;\n  esac\n}\n\nalias gs=\'scmpuff_status\'\nalias ga=\'git add\'\nalias gd=\'git diff\'\nalias gl=\'git log\'\nalias gco=\'git checkout\'\nalias grs=\'git reset\''
+(eval):56> unalias git
+(eval):57> unset -f git
+(eval):60> SCMPUFF_GIT_CMD=/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin/git
+(eval):61> export SCMPUFF_GIT_CMD
+(eval):77> alias 'gs=scmpuff_status'
+(eval):78> alias 'ga=git add'
+(eval):79> alias 'gd=git diff'
+(eval):80> alias 'gl=git log'
+(eval):81> alias 'gco=git checkout'
+(eval):82> alias 'grs=git reset'
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn:24> 'set +x'
/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn:24: command not found: set +x
+/var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn:25> /nix/store/6jvr5f0amb2dsjw6gmb620pwyiyywp27-coreutils-9.1/bin/rm /var/folders/kb/tjt27xcn6_dg095y88337mjm0000gn/T/tmp.a3yKgeszbn
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.profile:32> unset FLOX_PATH_PREPEND FLOX_ACTIVATE_VERBOSE FLOX_BASH_INIT_SCRIPT
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:24> [ -z '' ']'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:25> _floxPrompt1='%F{61}flox'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:26> _floxPrompt2='%F{216}[rust default]'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:27> _flox='%B%F{61}flox %F{216}[rust default]%f%b '
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:30> [ -n '%B%F{61}flox %F{216}[rust default]%f%b ' -a -n $'\n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) ' ']'
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:32> case
%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char)  (*\\n*)
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:32> case
%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char)  (*\\012*)
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:32> case
%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char)  (*)
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:40> PS1=$'%B%F{61}flox %F{216}[rust default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/etc/flox.zdotdir/.zshrc:46> unset _flox _floxPrompt1 _floxPrompt2
+precmd:1> echo -ne '\033]0;etorreborre\007'
+omz_termsupport_precmd:1> emulate -L zsh
+omz_termsupport_precmd:3> [[ '' == true ]]
+omz_termsupport_precmd:7> title '%15<..<%~%<<' '%n@%m: %~'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%n@%m: %~'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%n@%m:\ %~\a'
+title:13> print -Pn '\e]1;%15\<..\<%~%\<\<\a'
+_z_precmd:1> _z --add /Users/etorreborre
+iterm2_precmd:1> local STATUS=0
+_z:2> local datafile=/Users/etorreborre/.z
+iterm2_precmd:2> [ -z 1 ']'
+_z:5> [ -h /Users/etorreborre/.z ']'
+iterm2_precmd:7> iterm2_after_cmd_executes 0
+_z:8> [ -z '' -a -f /Users/etorreborre/.z -a '!' -O /Users/etorreborre/.z ']'
+iterm2_after_cmd_executes:1> printf '\033]133;D;%s\007' 0
+iterm2_after_cmd_executes:2> iterm2_print_state_data
+_z:20> [ --add '=' --add ']'
+iterm2_print_state_data:1> printf '\033]1337;RemoteHost=%s@%s\007' etorreborre sym
+_z:21> shift
+iterm2_print_state_data:2> printf '\033]1337;CurrentDir=%s\007' /Users/etorreborre
+iterm2_print_state_data:3> iterm2_print_user_vars
+_z:24> [ /Users/etorreborre '=' /Users/etorreborre ']'
+_z:24> return
+iterm2_print_user_vars:1> git branch --no-color
+iterm2_print_user_vars:1> grep '--color=auto' '--exclude-dir=.bzr' '--exclude-dir=CVS' '--exclude-dir=.git' '--exclude-dir=.hg' '--exclude-dir=.svn' '*'
+iterm2_print_user_vars:1> cut -c3-
+iterm2_print_user_vars:1> iterm2_set_user_var gitBranch
+iterm2_set_user_var:1> printf %s ''
+iterm2_set_user_var:1> base64
+iterm2_set_user_var:1> tr -d '\n'
+iterm2_set_user_var:1> printf '\033]1337;SetUserVar=%s=%s\007' gitBranch
+iterm2_precmd:9> [ -n 1 ']'
+iterm2_precmd:10> iterm2_decorate_prompt
+iterm2_decorate_prompt:3> ITERM2_PRECMD_PS1=$'%B%F{61}flox %F{216}[rust default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) '
+iterm2_decorate_prompt:4> ITERM2_SHOULD_DECORATE_PROMPT=''
+iterm2_decorate_prompt:7> [[ $'%B%F{61}flox %F{216}[rust default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) ' == *\$\(iterm2_prompt_mark\)* ]]
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_mark
+iterm2_prompt_mark:1> printf '\033]133;A\007'
+iterm2_decorate_prompt:11> PS1=+iterm2_decorate_prompt:11> iterm2_prompt_end
+iterm2_prompt_end:1> printf '\033]133;B\007'
+iterm2_decorate_prompt:11> PS1=$'%{\C-[]133;A\C-G%}%B%F{61}flox %F{216}[rust default]%f%b \n%{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)\n$(virtualenv_info)$(prompt_char) %{\C-[]133;B\C-G%}'
+/bin/zsh:1> collapse_pwd
+collapse_pwd:1> pwd
+collapse_pwd:1> sed -e 's,^/Users/etorreborre,~,'
+collapse_pwd:1> echo '~'
+/bin/zsh:1> hg_prompt_info
+hg_prompt_info:1> hg prompt --angle-brackets $'< on %{\C-[[35m%}<branch>%{\C-[[00m%}>< at %{\C-[[33m%}<tags|%{\C-[[00m%}, %{\C-[[33m%}>%{\C-[[00m%}>%{\C-[[32m%}<status|modified|unknown><update>%{\C-[[00m%}<\npatches: <patches|join( → )|pre_applied(%{\C-[[33m%})|post_applied(%{\C-[[00m%})|pre_unapplied(%{\C-[[01;30m%})|post_unapplied(%{\C-[[00m%})>>'
+/bin/zsh:1> git_prompt_info
+git_prompt_info:1> local ref
+git_prompt_info:2> [[+git_prompt_info:2> git config --get oh-my-zsh.hide-status
+git_prompt_info:2> [[ '' != 1 ]]
+git_prompt_info:3> ref=+git_prompt_info:3> git symbolic-ref HEAD
+git_prompt_info:3> ref=''
+git_prompt_info:4> ref=+git_prompt_info:4> git rev-parse --short HEAD
+git_prompt_info:4> ref=''
+git_prompt_info:4> return 0
+/bin/zsh:1> virtualenv_info
+virtualenv_info:1> [ ']'
+/bin/zsh:1> prompt_char
+prompt_char:1> git branch
+prompt_char:2> hg root
+prompt_char:3> echo ○
flox [rust default]

Then

○ echo $PATH
....
+/bin/zsh:1> echo /Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin:/Users/etorreborre/.symbiont/versions/current/bin
...

The ... stand for debug information which was displayed as the result of using --debug before (I already mentioned that issue somewhere)

Now the session that works has a small bug with the --debug flag:

○ . <(flox --debug activate -e rust)
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:139 hash_commands( ansifilter awk basename bash cat chmod cmp column cp curl cut dasel date dirname id jq getent gh git gum grep ln man mkdir mktemp mv nix nix-store parallel pwd readlink realpath rm rmdir sed sh sleep sort stat tail touch tr uuid xargs zgrep )
trace:/nix/store/clm98qbm57nc2wpww2jg6rgn20nwkhbs-flox-prerelease-0.0.6-r58/lib/utils.sh:158 first_in_PATH( vim vi nano emacs ed )
/dev/fd/11:1: parse error near `)'

but if I just go

○ . <(flox activate -e rust)

then my PATH is ok:

○ echo $PATH                                                                                                                                                                                                                                                               rust
/Users/etorreborre/.local/share/flox/environments/etorreborre/rust/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/Users/etorreborre/.local/share/flox/environments/etorreborre/default/bin:/opt/homebrew/bin:/Applications/google-cloud-sdk/bin:/Users/etorreborre/.ghcup/bin:/Users/etorreborre/.cabal/bin:/Users/etorreborre/.local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/opt/fzf/bin:/Users/etorreborre/.symbiont/versions/current/bin

(except maybe for the duplicated default/bin but it is harmless)

We can jump on an online session now if you have a moment.

sorry guys but I’ve kinda lost the plot on this one. :upside_down_face: Was this resolved offline? If not, @etorreborre - could you please summarise your outstanding queries so I can follow up? :slight_smile:

My understanding is that the team is aware of this issue and is working on it. And I thought that 0.7.0 would bring an answer. Isn’t that the case?

thank you for that update as I was trying to figure out if the outstanding issues were indeed going to be sorted with the next release (0.0.7) or if there was something further to be sorted for you. Michael has just confirmed to me the issues raised in this thread are addressed in the next release. yay!

The release is expected out soon and will be announced in discourse. :slight_smile:

1 Like

Thanks again @etorreborre for being patient with us! Version 0.0.7 included an overhaul of the environment activation code which should have fixed all the issues documented in this thread. Speaking to you offline I understand everything is now working for you - if you find that changes at any point please let us know!

1 Like