Squash merge move_to_single_file_pkgs into main

This commit is contained in:
Matthew Stobbs
2026-04-13 14:50:45 -06:00
parent ff740426c8
commit 8dc427f027
373 changed files with 3883 additions and 9963 deletions

View File

@@ -0,0 +1,22 @@
# vim: set filetype=yaml.ansible :
# Helper: external repository
---
- name: Add copr repository
when:
- ansible_os_family == 'RedHat'
community.general.copr:
host: "{{ repo.host | default('copr.fedorainfracloud.org') }}"
state: "{{ repo.state | default('enabled') }}"
name: "@{{ repo.name }}"
include: "{{ repo.include | default(omit) }}"
exclude: "{{ repo.exclude | default(omit) }}"
- name: Add apt ppa
when:
- ansible_os_family == 'Debian'
ansible.builtin.apt_repository:
codename: "{{ repo.codename | default(omit) }}"
filename: "{{ repo.filename | default(omit) }}"
install_python_apt: true
repo: "{{ repo.name }}"
state: "{{ repo.state | default('present') }}"

View File

@@ -0,0 +1,31 @@
# vim: set filetype=yaml.ansible :
---
- name: Install appimages {{ appimage.name }}
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
block:
- name: Ensure appimage path exists {{ appimage.name }}
ansible.builtin.file:
path: "{{ path_appimage }}/{{ appimage.name }}"
mode: "{{ appimage.mode | default('0755') }}"
owner: "{{ appimage.owner | default(ansible_user_id) }}"
group: "{{ appimage.group | default(ansible_user_gid) }}"
state: directory
- name: Fetch appimage {{ appimage.name }}
ansible.builtin.get_url:
mode: "{{ appimage.mode | default('0755') }}"
owner: "{{ appimage.owner | default(ansible_user_id) }}"
group: "{{ appimage.group | default(ansible_user_gid) }}"
url: "{{ appimage.url }}"
dest: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
checksum: "{{ appimage.checksum | default(omit) }}"
decompress: false
backup: false
- name: Link appimage to bin {{ appimage.name }}
vars:
links:
- from: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
to: "{{ path_bin }}/{{ appimage.name }}"
ansible.builtin.include_tasks: helpers/symlink.yml

52
tasks/helpers/archive.yml Normal file
View File

@@ -0,0 +1,52 @@
# vim: set filetype=yaml.ansible :
#
## Helpers: archive.yml
## Description: extract and symlink archives
## Variables: dict of key:value pairs
## extract_to: path to extract archive to
## name: filename of the archive
## url: download url of the archive
---
- name: Ensure requirements met
when:
- archive.extract_to is defined
- archive.name is defined
- archive.url is defined
block:
- name: Extract archive to given path {{ archive.name }}
block:
- name: Ensure directory exists
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.file:
state: directory
path: "{{ archive.extract_to }}"
mode: "{{ archive.mode | default('0755') }}"
owner: "{{ archive.owner | default(ansible_facts['user_id']) }}"
group: "{{ archive.group | default(ansible_facts['user_gid']) }}"
- name: Download archive to cache {{ archive.name }}
ansible.builtin.get_url:
dest: "{{ d_cache.path }}/{{ archive.name }}"
url: "{{ archive.url }}"
checksum: "{{ archive.checksum | default(omit) }}"
decompress: false
mode: '0644'
- name: Extract archive {{ archive.name }}
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.unarchive:
dest: "{{ archive.extract_to }}"
src: "{{ d_cache.path }}/{{ archive.name }}"
remote_src: true
include: "{{ archive.include | default(omit) }}"
exclude: "{{ archive.exclude | default(omit) }}"
- name: Symlink archive files {{ archive.name }}
when:
- archive.links is defined
- archive.links | length > 0
vars:
links: "{{ archive.links }}"
ansible.builtin.include_tasks: helpers/symlink.yml

17
tasks/helpers/cargo.yml Normal file
View File

@@ -0,0 +1,17 @@
# vim: set filetype=yaml.ansible :
#
## Helper: cargo.yml
## Description: Install packages using the cargo command
## Variables: top level 'dict'
## name: package name on cargo
## version: cargo version, omitted if empty
## locked: _bool_, optional. Default false
---
- name: Install with cargo {{ pkg.name }}
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.cargo:
name: "{{ pkg.name }}"
version: "{{ pkg.version | default(omit) }}"
locked: "{{ pkg.locked | default(false) }}"
path: "{{ install_prefix }}"

View File

@@ -0,0 +1,64 @@
# vim: set filetype=yaml.ansible :
#
## Helper: cargo_buil.yml
## Description: download source, build and install using cargo
## Variables: top level 'dict'
## source_dir: git source directory
## repo: git repository url
## depth: _int_ optional, Default 1. Git depth to clone
## force_git: _bool_ optional, default true. Force clone, overwriting existing dir
## recursive: _bool_ optional, default true. Do a recursive clone
## version: _string_ optional, default 'latest'. Version to checkout and build
## build_flags: _list[str]_ optional. If set, will append these to the build command
---
- name: Cargo source install helper
block:
- name: Fetch git repo
vars:
path: "{{ pkg.source_dir }}"
repo: "{{ pkg.git.repo }}"
depth: "{{ pkg.depth | default(1) }}"
force: "{{ pkg.force_git | default(true) }}"
recursive: "{{ pkg.recursive | default(true) }}"
version: "{{ pkg.git.version | default(omit) }}"
ansible.builtin.include_tasks: helpers/git.yml
- name: Build cargo release
ansible.builtin.command:
chdir: "{{ pkg.source_dir }}"
argv: "{{ ['cargo', 'build'] + pkg.build_flags }}"
- name: Clean existing install
vars:
files: "{{ pkg.files }}"
ansible.builtin.include_tasks: helpers/clean_install.yml
- name: Install cargo release
block:
# - name: Install files
# vars:
# source_dir: "{{ pkg.source_dir }}"
# pkg: "{{ pkg }}"
# ansible.builtin.include_tasks: helpers/install.yml
- name: Create directories
become: "{{ install_become }}"
become_user: "{{ install_become_user | default(omit) }}"
loop: "{{ pkg.files }}"
loop_control:
loop_var: file
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ [install_prefix, file.to] | path_join | dirname }}"
- name: Copy installable files
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ pkg.files }}"
loop_control:
loop_var: file
ansible.builtin.copy:
dest: "{{ install_prefix }}/{{ file.to }}"
mode: "{{ file.mode | default('0644') }}"
src: "{{ pkg.source_dir }}/{{ file.from }}"

View File

@@ -1,10 +1,21 @@
# vim: set filetype=yaml.ansible :
---
- name: Remove file list
become: true
loop: "{{ file_list }}"
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ files }}"
loop_control:
loop_var: file
when:
- file.to is defined
ansible.builtin.file:
state: absent
path: "{{ file }}"
path: "{{ install_prefix }}/{{ file.to }}"
- name: Check for and remove empty directories
loop: "{{ files }}"
loop_control:
loop_var: dir
when:
- file.directory is defined
ansible.builtin.include_tasks: internal/remove_empty_dir.yml

10
tasks/helpers/flatpak.yml Normal file
View File

@@ -0,0 +1,10 @@
# vim: set filetype=yaml.ansible :
---
- name: Install flatpak
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.flatpak:
name: "{{ flatpak.name }}"
remote: "{{ flatpak.remote }}"
method: "{{ flatpak.method | default('system') }}"
state: "{{ flatpak.state | default('present') }}"

View File

@@ -0,0 +1,11 @@
# vim: set filetype=yaml.ansible :
---
- name: Add flatpak remote
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.flatpak_remote:
name: "{{ remote.name }}"
flatpakrepo_url: "{{ remote.url }}"
enabled: "{{ remote.enabled | default(true) }}"
method: "{{ remote.method | default('system') }}"
state: "{{ remote.state | default('present') }}"

View File

@@ -1,7 +1,20 @@
- name: Clone git repository {{ src_pkg }}
# vim: set filetype=yaml.ansible :
#
## Helper: git.yml
## Description: pull git repositories
## Variables:
## path: Destination path when cloning
## repo: url to git repo
## depth: _optional_ (default: 1) set git clone depth
## force: _optional_ (default: true) force cloning to given path
## recursive: _optional_ (default: true) do a recursive clone
## version: _optional_ (default: empty) git branch/tag to clone
---
- name: Clone git repository
ansible.builtin.git:
depth: 1
force: true
dest: "{{ src_path }}"
repo: "{{ src_gitrepo }}"
version: "{{ src_version | default(omit) }}"
dest: "{{ path }}"
repo: "{{ repo }}"
depth: "{{ depth | default(1) }}"
force: "{{ force | default(true) }}"
recursive: "{{ recursive | default(true) }}"
version: "{{ version | default(omit) }}"

View File

@@ -0,0 +1,20 @@
# vim: set filetype=yaml.ansible :
---
- name: Clean existing go package {{ pkg.bin }}
vars:
files: "{{ pkg.files | default([]) }}"
ansible.builtin.include_tasks: helpers/clean_install.yml
- name: Install go package "{{ pkg.url }}"
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
environment:
GOBIN: "{{ path_bin }}"
GOROOT: "{{ path_go }}"
PATH: "{{ path_go }}/bin:$PATH"
ansible.builtin.command:
creates: "{{ pkg.bin }}"
argv:
- go
- install
- "{{ pkg.url }}"

42
tasks/helpers/install.yml Normal file
View File

@@ -0,0 +1,42 @@
# vim: set filetype=yaml.ansible :
#
## Helper: install.yml
## Description: install files defined in dict
## Variables:
## _Note_ This is mutually exclusive to having a 'to' key
## - directory: path prefixed by {{ install_prefix }} of a directory to
## be created
## mode: _optional_, _default_ '0755'
##
## _Note_ This is mutually exclusive to having a 'directory' key
## - to: where to install file to, prefixed with {{ install_prefix }}
## from: source file from build path root for package
## mode: _optional_, _default_ '0644'##
##
## Notes: This is only used when copying files or creating directories
## for installing. If a source package doesn't require you to manually
## copy anthing (go install, as an example), don't use this.
---
- name: Create directories
become: "{{ do_become }}"
become_user: "{{ do_become_user | default(omit) }}"
loop: "{{ pkg.files }}"
loop_control:
loop_var: dir
when:
- dir.directory is defined
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ install_prefix }}/{{ dir.directory }}"
- name: Copy installable files
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ pkg.files }}"
loop_control:
loop_var: file
ansible.builtin.copy:
dest: "{{ install_prefix }}/{{ file.to }}"
mode: "{{ file.mode | default('0644') }}"
src: "{{ source_dir }}/{{ file.from }}"

73
tasks/helpers/make.yml Normal file
View File

@@ -0,0 +1,73 @@
# vim: set filetype=yaml.ansible :
#
## Helper: make.yml
## Description: run make to build packages
## Variables:
##
---
- name: Fetch source code
vars:
path: "{{ pkg.path }}"
repo: "{{ pkg.repo }}"
version: "{{ pkg.version | default(omit) }}"
ansible.builtin.include_tasks: helpers/git.yml
- name: Run configure target
when:
- pkg.target.configure is defined
register: make_configure
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ pkg.target.configure.name }}"
params: "{{ pkg.target.configure.params | default(omit) }}"
- name: Run build target
when:
- pkg.target.build is defined
register: make_build
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ pkg.target.build.name }}"
params: "{{ target.params | default(omit) }}"
- name: Clean old installation
vars:
files: "{{ pkg.install_files }}"
when:
- pkg.install_files is defined
ansible.builtin.include_tasks: helpers/clean_install.yml
- name: Run preinstall targets
when:
- pkg.targets.preinstall is defined
loop: "{{ pkg.targets.preinstall }}"
loop_control:
loop_var: target
register: make_preinstall
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ target.name }}"
params: "{{ target.params | default(omit) }}"
- name: Run install target
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
when:
- pkg.targets.install is defined
register: make_install
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ pkg.targets.install.name }}"
params: "{{ pkg.targets.install.params | default(omit) }}"
- name: Run postinstall targets
when:
- pkg.targets.postinstall is defined
loop: "{{ pkg.targets.postinstall }}"
loop_control:
loop_var: target
register: make_postinstall
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ target.name }}"
params: "{{ target.params | default(omit) }}"

View File

@@ -0,0 +1,18 @@
# vim: set filetype=yaml.ansible :
---
- 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: Append config to pkg archive
ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + [__font_config] }}"

13
tasks/helpers/npm.yml Normal file
View File

@@ -0,0 +1,13 @@
# vim: set filetype=yaml.ansible :
---
- name: Dump npm pkg
ansible.builtin.debug:
var: pkg
- name: Install npm
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.npm:
global: "{{ pkg.global | default(true) }}"
name: "{{ pkg.name }}"
version: "{{ pkg.version | default('latest') }}"
state: "{{ pkg.state | default('present') }}"

17
tasks/helpers/pipx.yml Normal file
View File

@@ -0,0 +1,17 @@
# vim: set filetype=yaml.ansible :
#
## Helper: pipx.yml
## Description: modular approach to installing pip applications
## Variables:
## name: the name of the pip package to install
---
- name: Install pipx {{ pkg.name }}
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
environment:
PIPX_HOME: "{{ path_pipx }}"
PIPX_BIN_DIR: "{{ path_bin }}"
community.general.pipx:
executable: "{{ pipx_exec }}"
name: "{{ pkg.name }}"
state: latest

20
tasks/helpers/symlink.yml Normal file
View File

@@ -0,0 +1,20 @@
# vim: set filetype=yaml.ansible :
#
## Helper: symlink.yml
## Description: symlink source to target
## Variables:
## - from: the source of the symlink
## - to: path of the symlink
## - force: _optional_, force create the symlink
---
- name: Create symlinks
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ links }}"
loop_control:
loop_var: link
ansible.builtin.file:
state: link
path: "{{ link.to }}"
src: "{{ link.from }}"
force: "{{ link.force | default(omit) }}"

36
tasks/helpers/zig.yml Normal file
View File

@@ -0,0 +1,36 @@
# vim : set filetype=yaml.ansible :
#
## Helper: zig.yml
## Description: build and install zig based packages
## Variables: dict of key:value pairs
## source_path: Destination path when cloning/extracting
## git: passed into helpers/git.yml if present. See that for required dict keys
## archive: passed into helpers/archive.yml to extract if present. See that for required dict keys
## prefix: install prefix
## flags: flags to pass to zig build
---
- name: Clone git repository if it exists
when:
- pkg.git is defined
vars:
path: "{{ pkg.source_path }}"
repo: "{{ pkg.git.repo }}"
depth: "{{ pkg.git.depth | default(omit) }}"
force: "{{ pkg.git.force | default(omit) }}"
recursive: "{{ pkg.git.recursive | default(omit) }}"
version: "{{ pkg.version | default(omit) }}"
ansible.builtin.include_tasks: helpers/git.yml
- name: Download and extract source archive
when:
- pkg.archive is defined
ansible.builtin.include_tasks: helpers/archive.yml
- name: Ensure facts are set
ansible.builtin.set_fact:
zbf: "{{ pkg.build_flags | default([]) }}"
- name: Zig build and install
ansible.builtin.command:
argv: "{{ ['zig', 'build' '-p', install_prefix] + zbf }}"
chdir: "{{ pkg.source_path }}"