From 804ab3209a6741123c6717a23d9bdbb074b2f20b Mon Sep 17 00:00:00 2001 From: Vuong Hoang Date: Fri, 31 May 2024 18:51:47 -0700 Subject: [PATCH] Added starship --- ansible.cfg | 3 +- playbooks/apt_qol.yaml | 2 + playbooks/starship.yaml | 3 + roles/starship/files/starship.toml | 195 +++++++++++++++++++++++++++++ roles/starship/tasks/main.yaml | 32 +++++ 5 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 playbooks/starship.yaml create mode 100644 roles/starship/files/starship.toml create mode 100644 roles/starship/tasks/main.yaml diff --git a/ansible.cfg b/ansible.cfg index 4e6d8fd..1ef7bc0 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -222,7 +222,8 @@ inventory = ~/ansible/inventory/hosts.yaml ;remote_user= # (pathspec) Colon separated paths in which Ansible will search for Roles. -;roles_path=/home/lkraven/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles +#;roles_path=/home/lkraven/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles +roles_path=/home/lkraven/ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles # (string) Set the main callback used to display Ansible output. You can only have one at a time. # You can have many other callbacks, but just one can be in charge of stdout. diff --git a/playbooks/apt_qol.yaml b/playbooks/apt_qol.yaml index b3de424..428854a 100644 --- a/playbooks/apt_qol.yaml +++ b/playbooks/apt_qol.yaml @@ -9,5 +9,7 @@ - btop - htop - neofetch + - curl + - wget update_cache: true state: latest diff --git a/playbooks/starship.yaml b/playbooks/starship.yaml new file mode 100644 index 0000000..e256d37 --- /dev/null +++ b/playbooks/starship.yaml @@ -0,0 +1,3 @@ +- hosts: "all" + roles: + - starship diff --git a/roles/starship/files/starship.toml b/roles/starship/files/starship.toml new file mode 100644 index 0000000..f31b976 --- /dev/null +++ b/roles/starship/files/starship.toml @@ -0,0 +1,195 @@ +format = """ +[╭](fg:#6272A4)\ + $os\ +$username \ +$hostname \ +$directory\ +$git_branch\ +$git_status\ +$nodejs\ +$rust\ +$golang\ +$php\ +$conda\ +\n[╰──](fg:#6272A4)\ +$time$cmd_duration\ +[─](fg:#6272A4)\ +$character""" + +[time] +disabled = false +time_format = "%I:%M" # Hour:Minute Format +format = ' [$time ]($style)' +style = "#6272A4" + +[hostname] +ssh_only = false +ssh_symbol = "" +format = '[$ssh_symbol $hostname]($style)' +trim_at = '.companyname.com' +disabled = false +style = "#8BE9FD" + +[os] +format = " [$symbol($os)]($style)" +disabled = false +style = "bold #D6ACFF" + +[aws] +symbol = " " +style = "bold #ffb86c" + +[buf] +symbol = " " + +[c] +symbol = " " + +[conda] +symbol = " " + +[dart] +symbol = " " + +[directory] +read_only = " 󰌾" +read_only_style = '#ff5555' +style = "bold #50fa7b" + +[directory.substitutions] +"Documents" = "󰈙 " +"Downloads" = " " +"Music" = " " +"Pictures" = " " + +[docker_context] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[fossil_branch] +symbol = " " + +[git_branch] +symbol = " " +style = "bold #ff79c6" + +[golang] +symbol = " " + +[guix_shell] +symbol = " " + +[haskell] +symbol = " " + +[haxe] +symbol = "⌘ " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[lua] +symbol = " " + +[memory_usage] +symbol = "󰍛 " + +[meson] +symbol = "喝 " + +[nim] +symbol = " " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[os.symbols] +Alpaquita = " " +Alpine = " " +Amazon = " " +Android = " " +Arch = " " +Artix = " " +CentOS = " " +Debian = " " +DragonFly = " " +Emscripten = " " +EndeavourOS = " " +Fedora = " " +FreeBSD = " " +Gentoo = " " +Linux = " " +Mabox = " " +Macos = " " +Manjaro = " " +Mariner = " " +MidnightBSD = " " +Mint = " " +NetBSD = " " +NixOS = " " +OpenBSD = " " +openSUSE = " " +Pop = " " +Raspbian = " " +Redhat = " " +RedHatEnterprise = " " +Redox = " " +SUSE = " " +Ubuntu = " " +Unknown = " " +Windows = " " + +[package] +symbol = " " + +[pijul_channel] +symbol = "🪺 " + +[python] +symbol = " " + +[rlang] +symbol = "ﳒ " + +[ruby] +symbol = " " + +[rust] +symbol = " " + +[scala] +symbol = " " + +[spack] +symbol = "🅢 " + +[character] +success_symbol = '[󰁔](bold #6272A4)' +error_symbol = '[󰁔](bold #ff5555)' + +[cmd_duration] +min_time = 100 +style = "bold #6272A4" +format = '[─ $duration]($style) ' + +[git_status] +style = "bold #ff5555" + +[username] +format = "[$user]($style)" +style_user = "#BD93F9" +style_root = "#FFFFA5" diff --git a/roles/starship/tasks/main.yaml b/roles/starship/tasks/main.yaml new file mode 100644 index 0000000..d987685 --- /dev/null +++ b/roles/starship/tasks/main.yaml @@ -0,0 +1,32 @@ +--- +- name: create config directory + file: + path: "{{ ansible_user_dir }}/.config/" + state: directory + +- name: copy configuration + copy: + src: starship.toml + dest: "{{ ansible_user_dir }}/.config/starship.toml" + +- name: Get starship install script + get_url: + url: https://starship.rs/install.sh + dest: /tmp/starship_install.sh + mode: '0755' + +- name: Install starship + shell: + cmd: /tmp/starship_install.sh --yes + executable: /bin/sh + become: yes + +- name: Update bashrc + vars: + bashrcpath: "{{ ansible_user_dir }}/.bashrc" + blockinfile: + path: "{{ bashrcpath }}" + block: | + eval "$(starship init bash)" + state: present + create: true