Open tifandotme opened 1 month ago
Looks like it could possibly be due to this change:
https://github.com/nushell/nushell/commit/fce6146576dda0cbce4f091317176bb8b67fed07
...which (rightly or wrongly) causes $env.config.hooks.env_change
to be empty.
I am assuming this is a bug in nushell 0.99, as the change hasn't been documented in their changelog.
I have rolled back to nushell v.0.98.0 for now
Facing the very same issue, closing the one i had opened here as i didn't realized this is an ongoing issue since over a month
I ran into the same issue, I managed to solve it by appending the following at top of the generated file
$env.config = ($env | default {} config).config
$env.config = ($env.config | default {} hooks)
$env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change))
$env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD))
This will add the default PWD if it does not exist in env_change
, I think adding this to https://github.com/jdx/mise/blob/main/src/shell/nushell.rs should solve the issue but I'm not sure since I'm using nixos to setup mise and nushell
I'm using nixos with home-manager for this, so I'm using the following code
{ config, pkgs, ... }:
let
miseCmd = "${config.home.profileDirectory}/bin/mise";
in
{
# mise
programs.mise.enable = true;
programs.nushell = {
extraEnv = ''
let mise_cache = "${config.xdg.cacheHome}/mise"
if not ($mise_cache | path exists) {
mkdir $mise_cache
}
$env.config = ($env | default {} config).config
$env.config = ($env.config | default {} hooks)
$env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change))
$env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD))
${miseCmd} activate nu | save --force ${config.xdg.cacheHome}/mise/mise.nu
'';
extraConfig = ''
use ${config.xdg.cacheHome}/mise/mise.nu
'';
};
}
Oh i forgot to update here that the fix for this issue has already been merged in nushell. It will be available in the next release https://github.com/nushell/nushell/pull/14341.
In the mean time, before setting any env_change hooks, simply add $env.config.hooks.env_change = {}
to your config.
PS / Info given by nushell dev on discord
Describe the bug mise failed to activate in Nushell 0.99.0:
To Reproduce
Expected behavior Should not have any error when nu starts.
node -v
should also workmise doctor
outputAdditional context Add any other context about the problem here. Consider running mise with
--debug
or--trace
for extra debug info.