diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index 37899c4a2355..3f892b592ee7 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -64,6 +64,14 @@ in { ''; }; + enableXonshIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Xonsh integration. + ''; + }; + enableFishIntegration = mkOption { default = true; type = types.bool; @@ -172,6 +180,27 @@ in { ) ''); + programs.xonsh = mkIf cfg.enableXonshIntegration { + xonshrc = "xontrib load direnv"; + extraPackages = ps: + [ + (ps.buildPythonPackage { + name = "xonsh-direnv"; + src = pkgs.fetchFromGitHub { + owner = "74th"; + repo = "xonsh-direnv"; + rev = "fd086e737a2d54495619a40d2a0f9e96475626e7"; + hash = "sha256-6/V7ZYMOB3E7TO7y8emC5lfdgeYxmfc/yLnEhjrWQ54="; + }; + postPatch = '' + substituteInPlace xontrib/direnv.xsh --replace '$(direnv' '$(${ + getExe cfg.package + }' + ''; + }) + ]; + }; + home.sessionVariables = lib.mkIf cfg.silent { DIRENV_LOG_FORMAT = ""; }; }; }