1
0

Added Paru

This commit is contained in:
2025-11-03 18:53:38 +01:00
parent a89bfb740e
commit 0e72bb90f9
5 changed files with 80 additions and 0 deletions

View File

@@ -6,6 +6,11 @@
{{- $editor := promptBoolOnce . "features.editor" "Do you want to install Neovim" true }}
{{- $nix := promptBoolOnce . "features.editor" "Do you want to install the Nix package manager" true }}
{{- $paru := false -}}
{{ if eq .chezmoi.osRelease.id "arch" -}}
{{- $paru = promptBoolOnce . "features.editor" "Do you want to install the Paru package manager" true -}}
{{- end }}
[data]
email = {{ $email | quote }}
git_name = {{ $git_name | quote }}
@@ -15,3 +20,4 @@ shell = {{ $shell }}
git = {{ $git }}
editor = {{ $editor }}
nix = {{ $nix }}
paru = {{ $paru }}

View File

@@ -14,3 +14,7 @@
{{- if not .features.nix }}
.config/nix
{{- end }}
{{- if not .features.paru }}
.config/paru
{{- end }}

View File

@@ -0,0 +1,18 @@
[options]
# Reverse sort order of search results
BottomUp
# Remove makedeps unconditionally after install
RemoveMake
# Refresh sudo timestamp to avoid sudo re-prompts
SudoLoop
# Skip review of build files
SkipReview
# Remove build files after install
CleanAfter
# Show a menu to select packages during upgrades
UpgradeMenu

View File

@@ -31,3 +31,5 @@
when: features.editor == true
- role: nix
when: features.nix == true
- role: paru
when: chezmoi.osRelease.id == "arch" and features.paru == true

View File

@@ -0,0 +1,50 @@
- name: Ensure build prerequisites are present
become: true
ansible.builtin.pacman:
name:
- base-devel
- fakeroot
- name: Create temporary dir for build
ansible.builtin.tempfile:
state: directory
suffix: paru
register: paru_tmp
- name: Download the AUR snapshot
ansible.builtin.get_url:
url: "https://aur.archlinux.org/cgit/aur.git/snapshot/paru-bin.tar.gz"
dest: "{{ paru_tmp.path }}/paru-bin.tar.gz"
- name: Extract the snapshot
ansible.builtin.unarchive:
src: "{{ paru_tmp.path }}/paru-bin.tar.gz"
dest: "{{ paru_tmp.path }}"
remote_src: true
- name: Build the package (no install)
ansible.builtin.command:
cmd: makepkg --syncdeps --noconfirm
chdir: "{{ paru_tmp.path }}/paru-bin"
environment:
PKGDEST: "{{ paru_tmp.path }}/paru-bin"
- name: Locate built package(s)
ansible.builtin.find:
paths: "{{ paru_tmp.path }}/paru-bin"
patterns: "*.pkg.tar.zst"
file_type: file
register: built_pkgs
# Install with root, but OUTSIDE makepkg
- name: Install built package(s)
become: true
ansible.builtin.command:
cmd: "pacman -U --noconfirm {{ item.path }}"
creates: /usr/bin/paru
loop: "{{ built_pkgs.files }}"
- name: Remove temporary directory
ansible.builtin.file:
path: "{{ paru_tmp.path }}"
state: absent