From 5c9ec0d8e9bb2b358ee5cb57742fc5f55802dde2 Mon Sep 17 00:00:00 2001 From: David Wood Date: Fri, 11 Oct 2019 10:56:09 +0100 Subject: [PATCH] starship: add `package` option --- modules/programs/starship.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 81793c7a..db7cf926 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -26,6 +26,13 @@ in 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 = {}; @@ -64,7 +71,7 @@ in }; config = mkIf cfg.enable { - home.packages = [ pkgs.starship ]; + home.packages = [ cfg.package ]; xdg.configFile."starship.toml" = mkIf (cfg.settings != {}) { source = configFile cfg.settings; @@ -72,19 +79,19 @@ in 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 ''; };