direnv: add xonsh support

This commit is contained in:
paki23 2024-06-03 22:21:33 +02:00
parent 47351a4a4a
commit 68a710b2e3
No known key found for this signature in database
GPG key ID: 13160FFB4CEB03F2

View file

@ -64,6 +64,14 @@ in {
''; '';
}; };
enableXonshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Xonsh integration.
'';
};
enableFishIntegration = mkOption { enableFishIntegration = mkOption {
default = true; default = true;
type = types.bool; type = types.bool;
@ -129,6 +137,27 @@ in {
${getExe cfg.package} hook fish | source ${getExe cfg.package} hook fish | source
''); '');
programs.xonsh = mkIf cfg.enableXonshIntegration {
xonshrc = "xontrib load direnv";
extraPackages = ps:
[
(ps.buildPythonPackage rec {
name = "xonsh-direnv";
src = pkgs.fetchFromGitHub {
owner = "74th";
repo = name;
rev = "fd086e737a2d54495619a40d2a0f9e96475626e7";
hash = "sha256-h56Gx/MMCW4L6nGwLAhBkiR7bX+qfFk80LEsJMiDtjQ=";
};
postPatch = ''
substituteInPlace xontrib/direnv.xsh --replace '$(direnv' '$(${
getExe cfg.package
}'
'';
})
];
};
programs.nushell.extraConfig = mkIf cfg.enableNushellIntegration ( programs.nushell.extraConfig = mkIf cfg.enableNushellIntegration (
# Using mkAfter to make it more likely to appear after other # Using mkAfter to make it more likely to appear after other
# manipulations of the prompt. # manipulations of the prompt.