Files
ansible_role_package/tasks/pkgs/ghostty.yml

135 lines
4.4 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Package: ghostty
## Description: HW accelerated terminal emulator made with zig
## Version: 1.3.1
## Methods: [system, source, appimage]
## Helpers: [zig, repo, appimage]
---
- name: Set ghostty default facts # {{{
ansible.builtin.set_fact:
ghostty:
methods:
Archlinux: [system, source, appimage]
Alpine: [system, source, appimage]
default: [source, appimage]
pkgname:
default: ghostty
build_deps:
default:
- gtk4
- libadwaita
- gtk4-layer-shell
- pkgconf
- gettext
RedHat:
- gtk4-devel
- gtk4-layer-shell-devel
- libadwaita-devel
- gettext
Debian:
- libgtk-4-dev
- libgtk4-layer-shell-dev
- libadwaita-1-dev
- gettext
- libxml2-utils
Archlinux:
- gtk4
- gtk4-layer-shell
- libadwaita
- gettext
Alpine:
- gtk4.0-dev
- libadwaita-dev
- pkgconf
- ncurses
- gettext
- name: Finalise ghostty default facts
ansible.builtin.set_fact:
ghostty:
version: "{{ ghostty_version | default('1.3.1') }}"
base_url: https://releases.files.ghostty.org
methods: "{{ ghostty.methods[os_family] | default(ghostty.methods.default) }}"
pkg_deps: [zig]
pkgname: "{{ ghostty.pkgname[os_family] | default(ghostty.pkgname.default) }}"
build_deps: "{{ ghostty.build_deps[os_family] | default(ghostty.build_deps.default) }}"
appimage:
url: https://github.com/pkgforge-dev/ghostty-appimage/releases/download
name: ghostty
# }}}
- name: Configure ghostty
when:
- "'ghostty' not in __configured"
block:
- name: Set ghostty install method
when:
- ghostty_imethod is undefined
ansible.builtin.set_fact:
ghostty_imethod: "{{ imethod if imethod in ghostty.methods else ghostty.methods[0] }}"
- name: Configure ghostty system install
when:
- ghostty_imethod == 'system'
block:
- name: Queue ghostty to pkg_sys
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [ghostty.pkgname] }}"
ghostty_install: "{{ ghostty_imethod }}={{ ghostty.pkgname }}"
- name: Configure ghostty source install
when:
- ghostty_imethod == 'source'
block:
- name: Add ghostty package dependencies
when:
- ghostty.pkg_deps is defined
- ghostty.pkg_deps|length > 0
loop: "{{ ghostty.pkg_deps }}"
loop_control:
loop_var: dep
ansible.builtin.include_tasks: pkgs/{{ dep }}.yml
- name: Add ghostty system dependencies
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + ghostty.build_deps }}"
- name: Configure ghostty zig install
ansible.builtin.set_fact:
ghostty_source_install:
name: ghostty
source_path: "{{ path_archive }}/ghostty/ghostty-{{ ghostty.version }}"
archive:
extract_to: "{{ path_archive }}/ghostty"
name: "{{ ghostty.archive }}"
url: "{{ ghostty.source_url }}"
build_flags:
- "-Doptimize=ReleaseFast"
- name: Finalise ghostty source install
ansible.builtin.set_fact:
pkg_zig: "{{ pkg_zig + [ghostty_source_install] }}"
ghostty_install: "{{ ghostty_imethod }}={{ ghostty_source_install }}"
- name: Configure ghostty appimage install
when:
- ghostty_imethod == 'appimage'
block:
- name: Set ghostty appimage configuration
ansible.builtin.set_fact:
ghostty_appimage_install:
url: "{{ ghostty.appimage.url }}/v{{ ghostty.version }}"
name: "{{ ghostty.appimage.name }}"
filename: "Ghostty-{{ ghostty.version }}-{{ architecture }}.AppImage"
- name: Append ghostty to pkg_appimage
when:
- ghostty.method == 'appimage'
ansible.builtin.set_fact:
pkg_appimage: "{{ pkg_appimage + [ghostty_appimage_install] }}"
ghostty_install: "{{ ghostty_imethod }}={{ ghostty_appimage_install }}"
- name: Finalise ghostty configuration
ansible.builtin.set_fact:
__configured: "{{ __configured | combine( { 'ghostty': ghostty_install } ) }}"