Skip to content

Commit

Permalink
direnv: add xonsh support
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqui23 committed Dec 10, 2024
1 parent 0bd4aee commit 92b0e27
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions modules/programs/direnv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = ""; };
};
}

0 comments on commit 92b0e27

Please sign in to comment.