feat(shell): add support for atuin

This commit is contained in:
reo101 2023-05-13 00:17:07 +03:00
parent 46f6f90a0c
commit 5056fb39f1
Signed by: reo101
GPG key ID: 675AA7EF13964ACB

View file

@ -18,6 +18,11 @@ in
type = types.str; type = types.str;
default = "${config.home.username}"; default = "${config.home.username}";
}; };
atuin = mkOption {
description = "Integrate with atuin";
type = types.bool;
default = true;
};
direnv = mkOption { direnv = mkOption {
description = "Integrate with direnv"; description = "Integrate with direnv";
type = types.bool; type = types.bool;
@ -45,11 +50,14 @@ in
zsh zsh
starship starship
] ]
(optionals cfg.atuin [
atuin
])
(optionals cfg.direnv [ (optionals cfg.direnv [
zoxide direnv
]) ])
(optionals cfg.zoxide [ (optionals cfg.zoxide [
direnv zoxide
]) ])
]; ];
@ -78,11 +86,20 @@ in
initExtra = initExtra =
builtins.concatStringsSep "\n" builtins.concatStringsSep "\n"
[ [
(optionalString cfg.direnv '' (optionalString cfg.atuin ''
eval "$(${pkgs.zoxide}/bin/zoxide init zsh)" export ATUIN_NOBIND="true"
eval "$(${pkgs.atuin}/bin/atuin init zsh)"
function zvm_after_init() {
# bindkey '^r' _atuin_search_widget
zvm_bindkey viins '^R' _atuin_search_widget
}
'') '')
# NOTE: done by `programs.direnv`
# (optionalString cfg.direnv ''
# eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
# '')
(optionalString cfg.zoxide '' (optionalString cfg.zoxide ''
eval "$(${pkgs.direnv}/bin/direnv hook zsh)" eval "$(${pkgs.zoxide}/bin/zoxide init zsh)"
'') '')
cfg.extraConfig cfg.extraConfig
]; ];
@ -314,8 +331,3 @@ in
maintainers = with lib.maintainers; [ reo101 ]; maintainers = with lib.maintainers; [ reo101 ];
}; };
} }