aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/programs/starship.nix
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-02-03 10:05:30 +0100
committerKatharina Fey <kookie@spacekookie.de>2020-02-03 10:05:30 +0100
commitc488527c95c874d3b8743c915173ad7bfb05d5af (patch)
tree2b874dc5606a9dff44096a5e8557f00dc52ac2b6 /home-manager/modules/programs/starship.nix
parent899a451e08f7d6d2c8214d119c2a0316849a0ed4 (diff)
parent6cc4fd6ede4909226cb81d3475834251ed1b7210 (diff)
Merge commit '6cc4fd6ede4909226cb81d3475834251ed1b7210'
Diffstat (limited to 'home-manager/modules/programs/starship.nix')
-rw-r--r--home-manager/modules/programs/starship.nix45
1 files changed, 24 insertions, 21 deletions
diff --git a/home-manager/modules/programs/starship.nix b/home-manager/modules/programs/starship.nix
index 81793c7a6f6..7c7819865f7 100644
--- a/home-manager/modules/programs/starship.nix
+++ b/home-manager/modules/programs/starship.nix
@@ -7,28 +7,32 @@ let
cfg = config.programs.starship;
configFile = config:
- pkgs.runCommand "config.toml"
- {
- buildInputs = [ pkgs.remarshal ];
- preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- remarshal -if json -of toml \
- < ${pkgs.writeText "config.json" (builtins.toJSON config)} \
- > $out
- '';
-in
+ pkgs.runCommand "config.toml" {
+ buildInputs = [ pkgs.remarshal ];
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ } ''
+ remarshal -if json -of toml \
+ < ${pkgs.writeText "config.json" (builtins.toJSON config)} \
+ > $out
+ '';
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.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 {
type = types.attrs;
- default = {};
+ default = { };
description = ''
Configuration written to
<filename>~/.config/starship.toml</filename>.
@@ -64,27 +68,26 @@ in
};
config = mkIf cfg.enable {
- home.packages = [ pkgs.starship ];
+ home.packages = [ cfg.package ];
- xdg.configFile."starship.toml" = mkIf (cfg.settings != {}) {
- source = configFile cfg.settings;
- };
+ xdg.configFile."starship.toml" =
+ mkIf (cfg.settings != { }) { source = configFile cfg.settings; };
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ -z $INSIDE_EMACS ]]; then
- eval "$(${pkgs.starship}/bin/starship init bash)"
+ eval "$(${cfg.package}/bin/starship init bash)"
fi
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
if [ -z "$INSIDE_EMACS" ]; then
- eval "$(${pkgs.starship}/bin/starship init zsh)"
+ eval "$(${cfg.package}/bin/starship init zsh)"
fi
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
if test -z "$INSIDE_EMACS"
- eval (${pkgs.starship}/bin/starship init fish)
+ eval (${cfg.package}/bin/starship init fish)
end
'';
};