{
  config,
  lib,
  ...
}: let
  inherit (config.rose-pine) sources;

  cfg = config.programs.starship.rose-pine;
  enable = cfg.enable && config.programs.starship.enable;

  themeName =
    if (cfg.flavor == "main")
    then "rose-pine"
    else "rose-pine-${cfg.flavor}";
in {
  options.programs.starship.rose-pine = lib.rp.mkRosePineOpt {name = "starship";};

  config.programs.starship.settings = lib.mkIf enable (
    lib.importTOML "${sources.starship}/${themeName}.toml"
  );
}
