{
  marleylib,
  lib,
  config,
  ...
}: let
  cfg = config.marleyos.programs.starship;
in {
  config = lib.mkIf cfg.enable {
    programs.starship.settings = with config.lib.stylix.colors.withHashtag; let
      mkFormat = t: " [](fg:${base02})[${t}]($style)[](fg:${base02}) ";
      langFormat = mkFormat "$symbol$version";
    in
      marleylib.module.mkDefault' {
        format = lib.concatStrings [
          "$username"
          "$hostname"
          "$directory"
          "$nix_shell"
          "$git_branch"
          "$git_status"
          "$fill"
          "$c"
          "$elixir"
          "$elm"
          "$golang"
          "$haskell"
          "$java"
          "$julia"
          "$nodejs"
          "$nim"
          "$rust"
          "$scala"
          "$python"
          "$time"
          "$line_break"
          "$character"
        ];

        username = {
          disabled = false;
          format = " [](fg:${base02})[ 󰧱 $user@]($style)";
          show_always = true;
          style_root = "bg:${base02} fg:${base0D}";
          style_user = "bg:${base02} fg:${base0D}";
        };

        hostname = {
          ssh_only = false;
          format = "[$hostname ]($style)[](fg:${base02}) ";
          style = "bg:${base02} fg:${base0D}";
        };

        directory = {
          format = mkFormat " $path ";
          style = "bg:${base02} fg:${base0B}";
          truncation_length = 3;
          truncation_symbol = "…/";

          substitutions = {
            Documents = "󰈙";
            Downloads = " ";
            Music = " ";
            Pictures = " ";
          };
        };

        git_branch = {
          format = mkFormat " $symbol $branch ";
          style = "bg:${base02} fg:${base0C}";
          symbol = "";
        };

        git_status = {
          disabled = false;
          style = "bg:${base02} fg:${base08}";
          format = mkFormat "$all_status$ahead_behind";
          up_to_date = "[ ✓ ](bg:${base02} fg:${base0D})";
          untracked = "[?\\($count\\)](bg:${base02} fg:${base09})";
          stashed = "[\\$](bg:${base02} fg:${base0D})";
          modified = "[!\\($count\\)](bg:${base02} fg:${base09})";
          renamed = "[»\\($count\\)](bg:${base02} fg:${base0D})";
          deleted = "[✘\\($count\\)](style)";
          staged = "[++\\($count\\)](bg:${base02} fg:${base09})";
          ahead = "[⇡\\(\${count}\\)](bg:${base02} fg:${base0C})";
          diverged = "⇕[\\[](bg:${base02} fg:${base0D})[⇡\\(\${ahead_count}\\)](bg:${base02} fg:${base0C})[⇣\\(\${behind_count}\\)](bg:${base02} fg:${base0A})[\\]](bg:${base02} fg:${base0D})";
          behind = "[⇣\\(\${count}\\)](bg:${base02} fg:${base0A})";
        };

        fill = {
          style = "fg:${base02}";
          symbol = " ";
        };

        time = {
          disabled = false;
          format = mkFormat " $time 󰴈 ";
          style = "bg:${base02} fg:${base0A}";
          time_format = "%I:%M%P";
          use_12hr = true;
        };

        character = let
          vim = "";
          mkChar = sym: col: " [${sym}](fg:${col}) [󰄾](fg:${base0C})";
        in {
          success_symbol = mkChar "" "${base0D}";
          error_symbol = mkChar "󰋔" "${base08}";
          vimcmd_symbol = mkChar vim "${base0A}";
          vimcmd_replace_one_symbol = mkChar vim "${base0C}";
          vimcmd_replace_symbol = mkChar vim "${base0C}";
          vimcmd_visual_symbol = mkChar vim "${base0D}";
        };

        ### Languages ###
        c = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = " ";
        };

        elixir = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = " ";
        };

        elm = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = " ";
        };

        haskell = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = " ";
        };

        java = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = " ";
        };

        julia = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = " ";
        };

        nodejs = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = "󰎙 ";
        };

        nim = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = "󰆥 ";
        };

        python = {
          style = "bg:${base02} fg:${base0B}";
          disabled = false;
          symbol = " ";
        };

        rust = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = "";
        };

        scala = {
          style = "bg:${base02} fg:${base0B}";
          format = langFormat;
          disabled = false;
          symbol = " ";
        };

        ### Tools ###
        conda = {
          style = "bg:${base02} fg:${base0B}";
          format = mkFormat "$symbol$environment";
          disabled = false;
          symbol = "🅒 ";
        };

        nix_shell = {
          style = "bg:${base02} fg:${base0C}";
          format = mkFormat " $symbol $state( \($name\)) ";
          disabled = false;
          symbol = " ";
        };
      };
  };
}
