starship: add package
option
This commit is contained in:
parent
284b8d94d4
commit
5c9ec0d8e9
|
@ -26,6 +26,13 @@ in
|
||||||
options.programs.starship = {
|
options.programs.starship = {
|
||||||
enable = mkEnableOption "starship";
|
enable = mkEnableOption "starship";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.starship;
|
||||||
|
defaultText = literalExample "pkgs.starship";
|
||||||
|
description = "The package to use for the starship binary.";
|
||||||
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default = {};
|
default = {};
|
||||||
|
@ -64,7 +71,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ pkgs.starship ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."starship.toml" = mkIf (cfg.settings != {}) {
|
xdg.configFile."starship.toml" = mkIf (cfg.settings != {}) {
|
||||||
source = configFile cfg.settings;
|
source = configFile cfg.settings;
|
||||||
|
@ -72,19 +79,19 @@ in
|
||||||
|
|
||||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
if [[ -z $INSIDE_EMACS ]]; then
|
if [[ -z $INSIDE_EMACS ]]; then
|
||||||
eval "$(${pkgs.starship}/bin/starship init bash)"
|
eval "$(${cfg.package}/bin/starship init bash)"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||||
if [ -z "$INSIDE_EMACS" ]; then
|
if [ -z "$INSIDE_EMACS" ]; then
|
||||||
eval "$(${pkgs.starship}/bin/starship init zsh)"
|
eval "$(${cfg.package}/bin/starship init zsh)"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
|
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
|
||||||
if test -z "$INSIDE_EMACS"
|
if test -z "$INSIDE_EMACS"
|
||||||
eval (${pkgs.starship}/bin/starship init fish)
|
eval (${cfg.package}/bin/starship init fish)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue