mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-10 02:51:05 +01:00
starship: add enableInteractive option for fish
Some fish plugins such as https://github.com/acomagu/fish-async-prompt require that starship be initialized as non-interactive. When the `programs.starship.enableInteractive` option is enabled, starship is initialized at the end of the init script, outside the interactive block.
This commit is contained in:
parent
1cd17a2f76
commit
86ee1290d7
5 changed files with 100 additions and 1 deletions
|
|
@ -10,6 +10,8 @@ let
|
|||
|
||||
starshipCmd = "${config.home.profileDirectory}/bin/starship";
|
||||
|
||||
initFish =
|
||||
if cfg.enableInteractive then "interactiveShellInit" else "shellInitLast";
|
||||
in {
|
||||
meta.maintainers = [ ];
|
||||
|
||||
|
|
@ -71,6 +73,17 @@ in {
|
|||
default = true;
|
||||
};
|
||||
|
||||
enableInteractive = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Only enable starship when the shell is interactive. This option is only
|
||||
valid for the Fish shell.
|
||||
|
||||
Some plugins require this to be set to `false` to function correctly.
|
||||
'';
|
||||
};
|
||||
|
||||
enableTransience = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
|
@ -104,7 +117,7 @@ in {
|
|||
fi
|
||||
'';
|
||||
|
||||
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
|
||||
programs.fish.${initFish} = mkIf cfg.enableFishIntegration ''
|
||||
if test "$TERM" != "dumb"
|
||||
eval (${starshipCmd} init fish)
|
||||
${lib.optionalString cfg.enableTransience "enable_transience"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue