Bug Description
When mkIdes is used in a flake devShell together with direnv's use flake, the ides shellHook sets trap _ides_leave EXIT, which overrides direnv's internal EXIT trap. Direnv relies on this trap to capture the environment state after .envrc finishes executing. With the trap overridden, direnv captures nothing — no PATH, no environment variables, nothing — making the nix dev shell completely invisible to the shell (fish, bash, zsh).
Steps to Reproduce
- Create a flake with a devShell using
mkIdes:
devShells.default = mkIdes {
serviceDefs.foo = {
shellCommand = "echo hello";
systemd.remainAfterExit = true;
};
shellHook = ''
export MY_VAR=hello
'';
packages = [ pkgs.some-tool ];
};
- Add
.envrc:
- Run
direnv allow and check what direnv exports:
direnv export json | python3 -c "import sys,json; print(sorted(json.load(sys.stdin).keys()))"
Environment
- ides: from
github:manic-systems/ides (used via flake input)
- direnv: 2.37.1
- nix-direnv: 3.1.2
- OS: NixOS (linux)
- Shell: fish 3.x (also reproduces in bash)
Workaround
Save and restore direnv's EXIT trap around use flake in .envrc:
# shellcheck shell=bash
_direnv_exit_trap=$(trap -p EXIT)
use flake
eval "$_direnv_exit_trap"
Bug Description
When
mkIdesis used in a flake devShell together with direnv'suse flake, the ides shellHook setstrap _ides_leave EXIT, which overrides direnv's internal EXIT trap. Direnv relies on this trap to capture the environment state after.envrcfinishes executing. With the trap overridden, direnv captures nothing — noPATH, no environment variables, nothing — making the nix dev shell completely invisible to the shell (fish, bash, zsh).Steps to Reproduce
mkIdes:.envrc:direnv allowand check what direnv exports:Environment
github:manic-systems/ides(used via flake input)Workaround
Save and restore direnv's EXIT trap around
use flakein.envrc: