mirror of
https://github.com/nix-community/home-manager
synced 2024-11-14 15:19:45 +01:00
* starship: add nushell integration support (cherry picked from commit7ae7250df8
) * starship: fix nushell integration Overwrite starship/init.nu if already exists, since this is a cache file for sourcing in `init.nu`. (cherry picked from commit646ac0ad17
) * starship: re-add ion integration which was apparently mistakenly removed in commit7ae7250
(cherry picked from commita62e4c88d7
) * starship: Use mkEnableOption (#3701) --------- Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me> Co-authored-by: Aidan Gauland <aidalgol@users.noreply.github.com> Co-authored-by: Marcel Transier <34482842+marceltransier@users.noreply.github.com>
This commit is contained in:
parent
07b0b43a92
commit
b0be47978d
1 changed files with 25 additions and 20 deletions
|
@ -58,36 +58,24 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
enableBashIntegration = mkEnableOption "Bash integration" // {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Bash integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
enableZshIntegration = mkEnableOption "Zsh integration" // {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Zsh integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableFishIntegration = mkOption {
|
||||
enableFishIntegration = mkEnableOption "Fish integration" // {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Fish integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableIonIntegration = mkOption {
|
||||
enableIonIntegration = mkEnableOption "Ion integration" // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enableNushellIntegration = mkEnableOption "Nushell integration" // {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Ion integration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -121,5 +109,22 @@ in {
|
|||
eval $(${starshipCmd} init ion)
|
||||
end
|
||||
'';
|
||||
|
||||
programs.nushell = mkIf cfg.enableNushellIntegration {
|
||||
# Unfortunately nushell doesn't allow conditionally sourcing nor
|
||||
# conditionally setting (global) environment variables, which is why the
|
||||
# check for terminal compatibility (as seen above for the other shells) is
|
||||
# not done here.
|
||||
extraEnv = ''
|
||||
let starship_cache = "${config.xdg.cacheHome}/starship"
|
||||
if not ($starship_cache | path exists) {
|
||||
mkdir $starship_cache
|
||||
}
|
||||
${starshipCmd} init nu | save --force ${config.xdg.cacheHome}/starship/init.nu
|
||||
'';
|
||||
extraConfig = ''
|
||||
source ${config.xdg.cacheHome}/starship/init.nu
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue