mirror of
https://github.com/nix-community/home-manager
synced 2024-11-20 01:59:45 +01:00
zoxide: enable nushell integration
This commit is contained in:
parent
a34aaad2ae
commit
2f8d24b7f5
1 changed files with 26 additions and 9 deletions
|
@ -6,6 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.zoxide;
|
cfg = config.programs.zoxide;
|
||||||
|
|
||||||
|
cfgOptions = concatStringsSep " " cfg.options;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ maintainers.marsam ];
|
meta.maintainers = [ maintainers.marsam ];
|
||||||
|
|
||||||
|
@ -53,27 +55,42 @@ in {
|
||||||
Whether to enable Fish integration.
|
Whether to enable Fish integration.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableNushellIntegration = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to enable Nushell integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
eval "$(${cfg.package}/bin/zoxide init bash ${
|
eval "$(${cfg.package}/bin/zoxide init bash ${cfgOptions})"
|
||||||
concatStringsSep " " cfg.options
|
|
||||||
})"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||||
eval "$(${cfg.package}/bin/zoxide init zsh ${
|
eval "$(${cfg.package}/bin/zoxide init zsh ${cfgOptions})"
|
||||||
concatStringsSep " " cfg.options
|
|
||||||
})"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
|
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
|
||||||
${cfg.package}/bin/zoxide init fish ${
|
${cfg.package}/bin/zoxide init fish ${cfgOptions} | source
|
||||||
concatStringsSep " " cfg.options
|
'';
|
||||||
} | source
|
|
||||||
|
programs.nushell = mkIf cfg.enableNushellIntegration {
|
||||||
|
extraEnv = ''
|
||||||
|
let zoxide_cache = "${config.xdg.cacheHome}/zoxide"
|
||||||
|
if not ($zoxide_cache | path exists) {
|
||||||
|
mkdir $zoxide_cache
|
||||||
|
}
|
||||||
|
${cfg.package}/bin/zoxide init nushell ${cfgOptions} | save --force ${config.xdg.cacheHome}/zoxide/init.nu
|
||||||
|
'';
|
||||||
|
extraConfig = ''
|
||||||
|
source ${config.xdg.cacheHome}/zoxide/init.nu
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue