mirror of
https://github.com/nix-community/home-manager
synced 2024-12-22 01:39:47 +01:00
starship: add nushell integration support
This commit is contained in:
parent
4a12f304e0
commit
7ae7250df8
1 changed files with 24 additions and 5 deletions
|
@ -89,6 +89,14 @@ in {
|
||||||
Whether to enable Ion integration.
|
Whether to enable Ion integration.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableNushellIntegration = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to enable Nushell integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -116,10 +124,21 @@ in {
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.ion.initExtra = mkIf cfg.enableIonIntegration ''
|
programs.nushell = mkIf cfg.enableNushellIntegration {
|
||||||
if test $TERM != "dumb" && not exists -s INSIDE_EMACS || test $INSIDE_EMACS = "vterm"
|
# Unfortunately nushell doesn't allow conditionally sourcing nor
|
||||||
eval $(${starshipCmd} init ion)
|
# conditionally setting (global) environment variables, which is why the
|
||||||
end
|
# 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 ${config.xdg.cacheHome}/starship/init.nu
|
||||||
|
'';
|
||||||
|
extraConfig = ''
|
||||||
|
source ${config.xdg.cacheHome}/starship/init.nu
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue