working on nerdfonts still

This commit is contained in:
Matthew Stobbs
2026-02-10 16:13:44 -07:00
parent 906603b6d4
commit 2c1f4ec422
6 changed files with 74 additions and 88 deletions

View File

@@ -2,20 +2,33 @@
--- ---
- name: Set package_home_base for Darwin - name: Set package_home_base for Darwin
when: when:
- ansible_system == 'Darwin' - ansible_facts["system"] == 'Darwin'
ansible.builtin.set_fact: ansible.builtin.set_fact:
package_home_base: /Users package_home_base: /Users
- name: Set package_home_base for Linux - name: Set package_home_base for Linux
when: when:
- ansible_system == 'Linux' or - ansible_facts["system"] == 'Linux' or
ansible_os_family == 'FreeBSD' ansible_facts["os_family"] == 'FreeBSD'
ansible.builtin.set_fact: ansible.builtin.set_fact:
package_home_base: /home package_home_base: /home
- name: Set default paths
ansible.builtin.set_fact:
path_appimage: "{{ install_prefix }}/appimage"
path_archive: "{{ install_prefix }}/archive"
path_bin: "{{ install_prefix }}/bin"
path_cargo: "{{ install_prefix }}/cargo"
path_git: "{{ install_prefix }}/git"
path_go: "{{ install_prefix }}/go"
path_pipx: "{{ install_prefix }}/pipx"
store_path: "{{ ansible_facts['user_dir'] }}/.cache/ansible_role_package"
path_lib: "{{ install_prefix }}/lib"
- name: Set Linux specific facts - name: Set Linux specific facts
when: when:
- ansible_system == 'Linux' - ansible_facts["system"] == 'Linux'
ansible.builtin.set_fact: ansible.builtin.set_fact:
pipx_exec: "/usr/bin/pipx" pipx_exec: "/usr/bin/pipx"
path_lib: lib64 path_lib: lib64
@@ -23,13 +36,13 @@
- name: Set alpine linux specific facts - name: Set alpine linux specific facts
when: when:
- ansible_os_family == 'Alpine' - ansible_facts["os_family"] == 'Alpine'
ansible.builtin.set_fact: ansible.builtin.set_fact:
path_lib: lib path_lib: lib
- name: Set dist code if RedHat based - name: Set dist code if RedHat based
when: when:
- ansible_os_family == 'RedHat' - ansible_facts["os_family"] == 'RedHat'
changed_when: false changed_when: false
register: rpm_dist register: rpm_dist
ansible.builtin.command: ansible.builtin.command:
@@ -37,8 +50,8 @@
- name: Set macOS specific facts - name: Set macOS specific facts
when: when:
- ansible_distribution == 'MacOSX' or - ansible_facts["distribution"] == 'MacOSX' or
ansible_distribution == 'MacOS' ansible_facts["distribution"] == 'MacOS'
ansible.builtin.set_fact: ansible.builtin.set_fact:
brewtap: [] # homebrew taps to add brewtap: [] # homebrew taps to add
pipx_exec: "/opt/homebrew/bin/pipx" # pipx executable pipx_exec: "/opt/homebrew/bin/pipx" # pipx executable

View File

@@ -6,6 +6,9 @@
- archive.name is defined - archive.name is defined
- archive.url is defined - archive.url is defined
block: block:
- name: Dump archive vars
ansible.builtin.debug:
var: archive
- name: Extract archive to given path - name: Extract archive to given path
block: block:
- name: Ensure directory exists - name: Ensure directory exists
@@ -15,8 +18,8 @@
state: directory state: directory
path: "{{ archive.extract_to }}" path: "{{ archive.extract_to }}"
mode: "{{ archive.mode | default('0755') }}" mode: "{{ archive.mode | default('0755') }}"
owner: "{{ archive.owner | default(ansible_user_id)}}" owner: "{{ archive.owner | default(ansible_facts['user_id']) }}"
group: "{{ archive.group | default(ansible_user_gid) }}" group: "{{ archive.group | default(ansible_facts['user_gid']) }}"
- name: Download archive to cache - name: Download archive to cache
ansible.builtin.get_url: ansible.builtin.get_url:

View File

@@ -0,0 +1,27 @@
# vim: set filetype=yaml.ansible :
---
- name: Load nerdfonts list
ansible.builtin.include_vars:
file: nerdfonts.yml
name: __nerdfonts
- name: Generate nerdfont configs
when:
- __nerdfonts[nf] is defined
ansible.builtin.set_fact:
__font_config:
extract_to: "{{ path_archive }}/nerdfonts/{{ nf }}"
url: "{{ nerdfonts_base_url }}/{{ __nerdfonts[nf]['archive'] | default(nf) }}.tar.xz"
name: "{{ __nerdfonts[nf]['archive'] | default(nf) }}.tar.xz"
links:
- from: "{{ path_archive }}/nerdfonts/{{ nf }}"
to: "{{ install_prefix }}/{{ nerdfonts_install_path }}/{{ nf }}"
force: true
- name: Dump current nerdfont config
ansible.builtin.debug:
var: __font_config
- name: Append config to pkg archive
ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + [__font_config] }}"

View File

@@ -13,8 +13,8 @@
ansible.builtin.file: ansible.builtin.file:
path: "{{ store_path }}" path: "{{ store_path }}"
mode: '0755' mode: '0755'
owner: "{{ ansible_user_id }}" owner: "{{ ansible_facts['user_id'] }}"
group: "{{ ansible_user_gid }}" group: "{{ ansible_facts['user_gid'] }}"
state: directory state: directory
- name: Ensure required paths exists - name: Ensure required paths exists
@@ -40,16 +40,21 @@
- name: Read package configuration - name: Read package configuration
ansible.builtin.include_vars: ansible.builtin.include_vars:
file: pkglist.yml file: pkglist.yml
- name: Load nerdfonts list
ansible.builtin.include_vars:
file: nerdfonts.yml
name: __nerdfonts
- name: Add needed packages for Fedora - name: Add needed packages for Fedora
when: when:
- ansible_distribution == 'Fedora' - ansible_facts["distribution"] == 'Fedora'
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ packages_extra + ['python3-paramiko'] }}" pkg_sys: "{{ packages_extra + ['python3-paramiko'] }}"
- name: Add needed MacOS packages - name: Add needed MacOS packages
when: when:
- ansible_distribution == 'MacOSX' - ansible_facts["distribution"] == 'MacOSX'
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ packages_extra + ['gnu-tar', 'virtualenv'] }}" pkg_sys: "{{ packages_extra + ['gnu-tar', 'virtualenv'] }}"
@@ -159,13 +164,13 @@
- name: Linux specific tasks - name: Linux specific tasks
when: when:
- ansible_system == 'Linux' - ansible_facts["system"] == 'Linux'
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: linux.yml file: linux.yml
- name: MacOS specific tasks - name: MacOS specific tasks
when: when:
- ansible_distribution == 'MacOSX' - ansible_facts["distribution"] == 'MacOSX'
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: macos.yml file: macos.yml

View File

@@ -2,7 +2,7 @@
--- ---
- name: Add nerdfonts - name: Add nerdfonts
when: when:
- "'nerdfonts' in __configured" - "'nerdfonts' not in __configured"
block: block:
- name: Load nerdfonts list - name: Load nerdfonts list
ansible.builtin.include_vars: ansible.builtin.include_vars:
@@ -12,46 +12,30 @@
- name: Create nerdfonts directories - name: Create nerdfonts directories
become: "{{ install_become }}" become: "{{ install_become }}"
become_user: "{{ install_become_user }}" become_user: "{{ install_become_user }}"
when:
- nerdfonts_install_list|length > 0
loop: "{{ nerdfonts_install_list }}"
loop_control:
loop_var: nf
ansible.builtin.file: ansible.builtin.file:
state: directory state: directory
mode: '0755' mode: '0755'
path: "{{ install_prefix }}/{{ nerdfonts_install_path }}/{{ nf }}" path: "{{ install_prefix }}/{{ nerdfonts_install_path }}"
owner: "{{ install_prefix_owner }}" owner: "{{ install_prefix_owner }}"
group: "{{ install_prefix_group }}" group: "{{ install_prefix_group }}"
- name: Generate nerdfont configs - name: Configure nerdfonts archive install
when: when:
- nerdfonts_install_list|length > 0 - nerdfonts_install_list|length > 0
- ansible_facts["system"] != 'Darwin'
loop: "{{ nerdfonts_install_list }}" loop: "{{ nerdfonts_install_list }}"
loop_control: loop_control:
loop_var: nf loop_var: nf
ansible.bulitin.set_fact: ansible.builtin.include_tasks: helpers/nerdfont_config.yml
"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:
nerdfonts_archives: "{{ nerdfonts_archives + [] }}"
- name: Append nerdfonts to pkg_cask - name: Append nerdfonts to pkg_cask
when: when:
- ansible_system == 'Darwin' - ansible_facts["system"] == 'Darwin'
loop: "{{ nerdfonts.fonts }}" loop: "{{ nerdfonts_install_list }}"
loop_control: loop_control:
loop_var: font loop_var: nf
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cask: "{{ pkg_cask + [pkgconfig.nerdfonts.fonts[font].brew] }}" pkg_cask: "{{ pkg_cask + [__nerdfonts[nf].brew] }}"
- name: Set nerdfonts_configured - name: Set nerdfonts_configured
ansible.builtin.set_fact: ansible.builtin.set_fact:

View File

@@ -23,19 +23,6 @@ flatpak_default_remote: flathub
flatpak_method: system flatpak_method: system
flatpak_remotes: "{{ [flathub_remote] }}" flatpak_remotes: "{{ [flathub_remote] }}"
# Installation paths
path_appimage: "{{ install_prefix }}/appimage"
path_archive: "{{ install_prefix }}/archive"
path_bin: "{{ install_prefix }}/bin"
path_cargo: "{{ install_prefix }}/cargo"
path_git: "{{ store_path }}/git"
path_go: "{{ install_prefix }}/go"
path_pipx: "{{ install_prefix }}/pipx"
store_path: "{{ ansible_user_dir }}/.cache/ansible_role_package"
path_lib: "{{ install_prefix }}/lib"
# System paths
# empty lists that must be defined # empty lists that must be defined
pkg_appimage: [] # appimages to install pkg_appimage: [] # appimages to install
pkg_archive: [] # packages installed via prebuilt archive pkg_archive: [] # packages installed via prebuilt archive
@@ -129,41 +116,9 @@ ansible_ls_version: latest
ansible_ls_pkg_deps: ansible_ls_pkg_deps:
- pkgs/npm.yml - pkgs/npm.yml
# }}} # }}}
# go {{{
go_archive_version: 1.25.6
go_archive_archmap:
arm64: arm64
aarch64: arm64
x86_64: amd64
go_archive_url_base: https://go.dev/dl
go_archive_sums:
1.25.6:
Darwin:
amd64: sha256:e2b5b237f5c262931b8e280ac4b8363f156e19bfad5270c099998932819670b7
arm64: sha256:984521ae978a5377c7d782fd2dd953291840d7d3d0bd95781a1f32f16d94a006
Linux:
amd64: sha256:f022b6aad78e362bcba9b0b94d09ad58c5a70c6ba3b7582905fababf5fe0181a
arm64: sha256:738ef87d79c34272424ccdf83302b7b0300b8b096ed443896089306117943dd5
FreeBSD:
amd64: sha256:61e1d50e332359474ff6dcf4bc0bd34ba2d2cf4ef649593a5faa527f0ab84e2b
arm64: sha256:648484146702dd58db0e2c3d15bda3560340d149ed574936e63285a823116b77
go_profile_path:
Linux: /etc/profile.d
FreeBSD: /etc/profile.d
go_pkgname:
RedHat: go
Debian: go
Darwin: go
FreeBSD:
default: go
1.25: go125
1.24: go124
1.23: go123
1.22: go122
# }}}
# {{{ nerdfonts # {{{ nerdfonts
nerdfonts_install_list: nerdfonts_install_list:
JetBrainsMono - JetBrainsMono
- FiraCode - FiraCode
- FiraMono - FiraMono
- GoMono - GoMono
@@ -171,5 +126,4 @@ nerdfonts_install_list:
- Symbols - Symbols
nerdfonts_base_url: https://github.com/ryanoasis/nerd-fonts/releases/latest/download nerdfonts_base_url: https://github.com/ryanoasis/nerd-fonts/releases/latest/download
nerdfonts_install_path: share/fonts nerdfonts_install_path: share/fonts
nerdfonts_archives: []
# }}} # }}}