From d3138a5093a6660c731157c206b97686578bfe9d Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Fri, 29 Nov 2024 22:26:53 +0000 Subject: [PATCH] Configure direnv for nushell --- home-manager/modules/programs/devel.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/home-manager/modules/programs/devel.nix b/home-manager/modules/programs/devel.nix index d6019d2..a86ee4b 100644 --- a/home-manager/modules/programs/devel.nix +++ b/home-manager/modules/programs/devel.nix @@ -18,5 +18,22 @@ ]; programs = { direnv.enable = true; + # Configure direnv with nushell + programs.nushell.extraConfig = '' + $env.config = { + hooks: { + pre_prompt: [{ || + if (which direnv | is-empty) { + return + } + + direnv export json | from json | default {} | load-env + if 'ENV_CONVERSIONS' in $env and 'PATH' in $env.ENV_CONVERSIONS { + $env.PATH = do $env.ENV_CONVERSIONS.PATH.from_string $env.PATH + } + }] + } + } + ''; }; }