nixos/starship: allow setting package

Changed files
+6 -4
nixos
modules
programs
+6 -4
nixos/modules/programs/starship.nix
···
nativeBuildInputs = [ pkgs.yq ];
} ''
tomlq -s -t 'reduce .[] as $item ({}; . * $item)' \
-
${lib.concatStringsSep " " (map (f: "${pkgs.starship}/share/starship/presets/${f}.toml") cfg.presets)} \
${userSettingsFile} \
> $out
'';
···
{
options.programs.starship = {
enable = lib.mkEnableOption (lib.mdDoc "the Starship shell prompt");
interactiveOnly = lib.mkOption {
default = true;
···
if [[ ! -f "$HOME/.config/starship.toml" ]]; then
export STARSHIP_CONFIG=${settingsFile}
fi
-
eval "$(${pkgs.starship}/bin/starship init bash)"
fi
'';
···
if not test -f "$HOME/.config/starship.toml";
set -x STARSHIP_CONFIG ${settingsFile}
end
-
eval (${pkgs.starship}/bin/starship init fish)
end
'';
···
if [[ ! -f "$HOME/.config/starship.toml" ]]; then
export STARSHIP_CONFIG=${settingsFile}
fi
-
eval "$(${pkgs.starship}/bin/starship init zsh)"
fi
'';
};
···
nativeBuildInputs = [ pkgs.yq ];
} ''
tomlq -s -t 'reduce .[] as $item ({}; . * $item)' \
+
${lib.concatStringsSep " " (map (f: "${cfg.package}/share/starship/presets/${f}.toml") cfg.presets)} \
${userSettingsFile} \
> $out
'';
···
{
options.programs.starship = {
enable = lib.mkEnableOption (lib.mdDoc "the Starship shell prompt");
+
+
package = lib.mkPackageOption pkgs "starship" { };
interactiveOnly = lib.mkOption {
default = true;
···
if [[ ! -f "$HOME/.config/starship.toml" ]]; then
export STARSHIP_CONFIG=${settingsFile}
fi
+
eval "$(${cfg.package}/bin/starship init bash)"
fi
'';
···
if not test -f "$HOME/.config/starship.toml";
set -x STARSHIP_CONFIG ${settingsFile}
end
+
eval (${cfg.package}/bin/starship init fish)
end
'';
···
if [[ ! -f "$HOME/.config/starship.toml" ]]; then
export STARSHIP_CONFIG=${settingsFile}
fi
+
eval "$(${cfg.package}/bin/starship init zsh)"
fi
'';
};