From 1135a34bb65d893ee00be9e009b61cf6ff62dcc4 Mon Sep 17 00:00:00 2001 From: Lumpiasty Date: Fri, 20 Feb 2026 21:22:25 +0100 Subject: [PATCH] enhance direnv integration for VSCode terminal --- home-modules/dev.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/home-modules/dev.nix b/home-modules/dev.nix index c99bfcd..babfd71 100644 --- a/home-modules/dev.nix +++ b/home-modules/dev.nix @@ -72,5 +72,21 @@ }; programs.direnv.enable = true; + + # Replace the default bash integration with our own + # which can be disabled with the DISABLE_DIRENV environment variable + # useful for VSCode's integrated terminal with direnv extension + # so we don't apply the direnv hook twice + # TODO: configure vscode to set DISABLE_DIRENV in the integrated terminal + programs.direnv.enableBashIntegration = false; + programs.bash.initExtra = ( + # Using `mkAfter` to make it more likely to appear after other + # manipulations of the prompt. + lib.mkAfter '' + if [ -z "$DISABLE_DIRENV" ]; then + eval "$(${lib.getExe config.programs.direnv.package} hook bash)" + fi + '' + ); }; } \ No newline at end of file