Are the hooks working with flox 1.0.1?

I have done more attempts at fixing this issue by trimming down my .zshrc file but I am still unsuccessful:

  • If I run flox activate -d my_env then I get an echo message + the environment aliases

  • If I enter a directory with a .envrc file containing eval "$(FLOX_SHELL=bash flox activate -d my_env)", then I get an echo message but the aliases are missing

Is it something that you can reproduce on your end too?

Thanks.

Are you setting FLOX_SHELL=bash and then eval’ing with zsh or bash? I’m not currently able to reproduce.

With flox 1.0.2 and this manifest:

> flox list -c -d /tmp
[profile]
common = """
  echo hello
  alias a="echo 'this is an alias'"
"""

[options]
systems = ["aarch64-darwin"]

zsh seems okay:

> eval "$(FLOX_SHELL=zsh flox activate -d /tmp)"
hello
flox [tmp mkenigs/default] Matthews-MacBook-Pro-2% a
this is an alias

bash seems okay:

> /bin/bash

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ eval "$(FLOX_SHELL=bash flox activate -d /tmp)"
hello
flox [tmp mkenigs/default] %m%# a
this is an alias

Could you please also try with direnv?

My .envrc just contains

eval "$(FLOX_SHELL=bash flox activate -d my_env)"

Ah sorry should have done that in the first place, let me see

Hmm yeah it looks like direnv may be the issue. I didn’t read through the whole thing, but looks like direnv doesn’t support aliases? Picking up aliases and functions · Issue #73 · direnv/direnv · GitHub

2 Likes

Oh, I didn’t see that. Thanks for the pointer!

In case this helps other people, I resorted to using this workaround for direnv.