atuin: enable nushell integration

This commit is contained in:
happysalada 2023-04-03 09:48:47 -04:00 committed by Robert Helgesson
parent fa980cc985
commit 2dcb61d396
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -85,6 +85,14 @@ in {
of options.
'';
};
enableNushellIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Nushell integration.
'';
};
};
config = let flagsStr = escapeShellArgs cfg.flags;
@ -114,5 +122,18 @@ in {
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
${cfg.package}/bin/atuin init fish ${flagsStr} | source
'';
programs.nushell = mkIf cfg.enableNushellIntegration {
extraEnv = ''
let atuin_cache = "${config.xdg.cacheHome}/atuin"
if not ($atuin_cache | path exists) {
mkdir $atuin_cache
}
${cfg.package}/bin/atuin init nu | save --force ${config.xdg.cacheHome}/atuin/init.nu
'';
extraConfig = ''
source ${config.xdg.cacheHome}/atuin/init.nu
'';
};
};
}