Open danx12 opened 1 month ago
Hey @danx12 - the problem is that most packages on conda-forge or in the conda ecosystem only ship activation scripts for bash or CMD.EXE (.bat) files. PowerShell does not know how to source them (afaik). The trick that we are doing in pixi shell
is that we execute the scripts, record the new environment variables (from cmd.exe or bash), and export the new env vars.
shell-hook
on the other hand does just straight-forward activate the env.
One way you could work around it might be to do pixi run powershell
- which would execute powershell in the context of the activated environment.
We could also add a flag to shell-hook
that would just export variables in the same way as we do for run
or shell
.
If you would like to give a PR a try, it could be done quite easily and I would be happy to guide you!
Checks
[x] I have checked that this issue has not already been reported.
[x] I have confirmed this bug exists on the latest version of pixi, using
pixi --version
.Reproducible example
pixi.toml
Issue description
pixi shell-hook --shell=powershell
does not inject the package activation scripts contained in theetc/conda/activate.d
directory.Note that I originally reproduced this issue with a privately built package that also uses activation scripts, not with
go
.Compared to using
cmd
, where the@CALL
at the end of the script will call the activation script.Somewhat related to https://github.com/prefix-dev/pixi/issues/1527 but in this case for
powershell
.Expected behavior
Running
pixi shell-hook --shell=powershell
also contains calls to run the package activation scripts.