diff --git a/tasks/pkgs/nerdfonts.yml b/tasks/pkgs/nerdfonts.yml index 060bbbb..6fa52d5 100644 --- a/tasks/pkgs/nerdfonts.yml +++ b/tasks/pkgs/nerdfonts.yml @@ -2,17 +2,47 @@ --- - name: Add nerdfonts when: - - nerdfonts_configured is undefined + - "'nerdfonts' in __configured" block: - - name: Load nerdfonts config - ansible.builtin.include_tasks: - file: config/nerdfonts.yml + - name: Load nerdfonts list + ansible.builtin.include_vars: + file: nerdfonts.yml + name: __nerdfonts - - name: Append nerdfonts to pkg_archive + - name: Create nerdfonts directories + become: "{{ install_become }}" + become_user: "{{ install_become_user }}" when: - - ansible_system == 'Linux' + - nerdfonts_install_list|length > 0 + loop: "{{ nerdfonts_install_list }}" + loop_control: + loop_var: nf + ansible.builtin.file: + state: directory + mode: '0755' + path: "{{ install_prefix }}/{{ nerdfonts_install_path }}/{{ nf }}" + owner: "{{ install_prefix_owner }}" + group: "{{ install_prefix_group }}" + + - name: Generate nerdfont configs + when: + - nerdfonts_install_list|length > 0 + loop: "{{ nerdfonts_install_list }}" + loop_control: + loop_var: nf + ansible.bulitin.set_fact: + "nerdfont_{{ nf }}": + extract_to: "{{ install_prefix }}/{{ nerdfonts_install_path }}/{{ nf }}" + url: "{{ nerdfonts_base_url }}/{{ __nerdfonts[nf].archive | default(nf) }}.tar.xz" + + - name: Create nerdfont install list + when: + - nerdfonts_install_list|length > 0 + loop: "{{ nerdfonts_install_list }}" + loop_control: + loop_var: nf ansible.builtin.set_fact: - pkg_archive: "{{ pkg_archive + ['nerdfonts'] }}" + nerdfonts_archives: "{{ nerdfonts_archives + [] }}" - name: Append nerdfonts to pkg_cask when: @@ -25,4 +55,4 @@ - name: Set nerdfonts_configured ansible.builtin.set_fact: - nerdfonts_configured: true + __configured: "{{ __configured | combine( { 'nerdfonts': true } ) }}" diff --git a/vars/main.yml b/vars/main.yml index 335a8b4..0a35f79 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -161,3 +161,15 @@ go_pkgname: 1.23: go123 1.22: go122 # }}} +# {{{ nerdfonts +nerdfonts_install_list: + JetBrainsMono + - FiraCode + - FiraMono + - GoMono + - Hack + - Symbols +nerdfonts_base_url: https://github.com/ryanoasis/nerd-fonts/releases/latest/download +nerdfonts_install_path: share/fonts +nerdfonts_archives: [] +# }}} diff --git a/vars/nerdfonts.yml b/vars/nerdfonts.yml new file mode 100644 index 0000000..39bcd99 --- /dev/null +++ b/vars/nerdfonts.yml @@ -0,0 +1,164 @@ +fonts: + 0xProto: + brew: font-0xproto-nerd-font + "3270": + brew: font-3270-nerd-font + Agave: + brew: font-agave-nerd-font + AnonymicePro: + archive: AnonymousPro + brew: font-anonymice-nerd-font + Arimo: + brew: font-arimo-nerd-font + AurulentSansM: + archive: AurulentSansMono + brew: font-aurulent-sans-mono-nerd-font + BigBlueTerm: + archive: BigBlueTerminal + brew: font-bigblue-terminal-nerd-font + BitstromWera: + archive: BitstreamVeraSansMono + brew: font-bitstream-vera-sans-mono-nerd-font + BlexMono: + archive: IBMPlexMono + brew: font-blex-mono-nerd-font + CaskaydiaCove: + archive: CascadiaCode + brew: font-caskaydia-cove-nerd-font + CaskaydiaMono: + archive: CascadiaMono + brew: font-caskaydia-mono-nerd-font + CodeNewRoman: + brew: font-code-new-roman-nerd-font + ComicShannsMono: + brew: font-comic-shanns-mono-nerd-font + CommitMono: + brew: font-commit-mono-nerd-font + Cousine: + brew: font-cousine-nerd-font + D2CodingLigature: + archive: D2Coding + brew: font-d2coding-nerd-font + DaddyTimeMono: + brew: font-daddy-time-mono-nerd-font + DejaVuSansM: + archive: DejaVuSansMono + brew: font-dejavu-sans-mono-nerd-font + DepartureMono: + brew: font-departure-mono-nerd-font + DroidSansM: + archive: DroidSansMono + brew: font-droid-sans-mono-nerd-font + EnvyCodeR: + brew: font-envy-code-r-nerd-font + FantasqueSansM: + archive: FantasqueSansMono + brew: font-fantasque-sans-mono-nerd-font + FiraCode: + brew: font-fira-code-nerd-font + FiraMono: + brew: font-fira-mono-nerd-font + GeistMono: + brew: font-geist-mono-nerd-font + GoMono: + archive: Go-Mono + brew: font-go-mono-nerd-font + GohuFont: + archive: Gohu + brew: font-gohufont-nerd-font + Hack: + brew: font-hack-nerd-font + Hasklug: + archive: Hasklig + brew: font-hasklug-nerd-font + HeavyData: + brew: font-heavy-data-nerd-font + Hurmit: + archive: Hermit + brew: font-hurmit-nerd-font + iMWriting: + archive: IA-Writer + brew: font-im-writing-nerd-font + Inconsolata: + brew: font-inconsolata-nerd-font + InconsolataGo: + brew: font-inconsolata-go-nerd-font + InconsolataLGC: + brew: font-inconsolata-lgc-nerd-font + IntoneMono: + archive: IntelOneMono + brew: font-intone-mono-nerd-font + Iosevka: + brew: font-iosevka-nerd-font + IosevkaTerm: + brew: font-iosevka-term-nerd-font + IosevkaTermSlab: + brew: font-iosevka-term-slab-nerd-font + JetBrainsMono: + brew: font-jetbrains-mono-nerd-font + Lekton: + brew: font-lekton-nerd-font + LiterationMono: + archive: LiberationMono + brew: font-liberation-nerd-font + Lilex: + brew: font-lilex-nerd-font + MartianMono: + brew: font-martian-mono-nerd-font + MesloLG: + archive: Meslo + brew: font-meslo-lg-nerd-font + Monaspice: + archive: Monaspace + brew: font-monaspace-nerd-font + Monofur: + brew: font-monofur-nerd-font + Monoid: + brew: font-monoid-nerd-font + Mononoki: + brew: font-mononoki-nerd-font + M+: + archive: MPlus + brew: font-m+-nerd-font + Noto: + brew: font-noto-nerd-font + OpenDyslexic: + brew: font-open-dyslexic-nerd-font + Overpass: + brew: font-overpass-nerd-font + ProFont: + brew: font-profont-nerd-font + ProggyClean: + brew: font-proggy-clean-tt-nerd-font + RecMono: + archive: Recursive + brew: font-recursive-mono-nerd-font + RobotoMono: + brew: font-roboto-mono-nerd-font + ShureTechMono: + archive: ShareTechMono + brew: font-shure-tech-mono-nerd-font + SauceCodePro: + archive: SourceCodePro + brew: font-sauce-code-pro-nerd-font + SpaceMono: + brew: font-space-mono-nerd-font + Symbols: + archive: NerdFontsSymbolsOnly + brew: font-symbols-only-nerd-font + Terminess: + archive: Terminus + brew: font-terminess-ttf-nerd-font + Tinos: + brew: font-tinos-nerd-font + Ubuntu: + brew: font-ubuntu-nerd-font + UbuntuMono: + brew: font-ubuntu-mono-nerd-font + UbuntuSans: + brew: font-ubuntu-sans-nerd-font + VictorMono: + brew: font-victor-mono-nerd-font + ZedMono: + brew: font-zed-mono-nerd-font +base_url: https://github.com/ryanoasis/nerd-fonts/releases/latest/download