nixos/direnv: add xonsh integration

This commit is contained in:
SamLukeYes
2025-02-20 22:19:01 +08:00
parent 7379cc70e6
commit 9c22fc4730

View File

@@ -34,6 +34,9 @@ in
enableFishIntegration = enabledOption ''
Fish integration
'';
enableXonshIntegration = enabledOption ''
Xonsh integration
'';
direnvrcExtra = lib.mkOption {
type = lib.types.lines;
@@ -94,6 +97,19 @@ in
${lib.getExe cfg.package} hook fish | source
end
'';
xonsh = lib.mkIf cfg.enableXonshIntegration {
extraPackages = ps: [ ps.xonsh.xontribs.xonsh-direnv ];
config = ''
if ${
if cfg.loadInNixShell then
"True"
else
"not any(map(lambda s: s.startswith('/nix/store'), __xonsh__.env.get('PATH')))"
}:
xontrib load direnv
'';
};
};
environment = {