diff --git a/README.md b/README.md index 96db1ee..04ddcd4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ special handling. Order of precedence for package installation: 1. System package manager (dnf, apt, homebrew, etc.) -2. Source built - only in some situations, like for fast moving software (neovim) +2. Source built - only in some situations, like for fast moving software (neovim, hyprland) 3. Appimage (Linux only) 4. Flatpak (Linux only) 5. Snap (Linux only), takes precedence over flatpak on Ubuntu based systems diff --git a/tasks/helpers/go.yml b/tasks/helpers/go.yml index 4c1c607..38b99c6 100644 --- a/tasks/helpers/go.yml +++ b/tasks/helpers/go.yml @@ -1,9 +1,17 @@ # vim: set filetype=yaml.ansible : --- -- name: Install go package {{ pkg }} - become: "{{ ext_become }}" +- name: Install go packages + become: "{{ install_become }}" environment: - GOBIN: "{{ path.bin }}" - PATH: "{{ path.go }}/bin:$PATH" + GOBIN: "{{ path_bin }}" + GOROOT: "{{ path_go }}" + PATH: "{{ path_go }}/bin:$PATH" + loop: pkg_go + loop_control: + loop_var: current ansible.builtin.command: - cmd: go install {{ pkg }} + creates: "{{ current.bin }}" + argv: + - go + - install + - "{{ current.url }}" diff --git a/tasks/pkgs/air.yml b/tasks/pkgs/air.yml index 9003993..aae2976 100644 --- a/tasks/pkgs/air.yml +++ b/tasks/pkgs/air.yml @@ -1,9 +1,8 @@ # vim: set filetype=yaml.ansible : --- -- name: Set air configuration # {{{ +- name: Configure air # {{{ when: - - __air_configured is undefined or - not __air_configured + - __air_configured is undefined block: - name: Set air install method when: @@ -11,21 +10,40 @@ ansible.builtin.set_fact: air_install_method: "{% if install_method in air_install_methods %}{{ install_method }}{% else %}{{ air_install_method[0] }}{% endif %}" - - name: Set air version and url - ansible.builtin.set_fact: - air_version: "{{ air_version | default('latest') }}" - air_install_url: "{{ air_install_url | default('github.com/air-verse/air') }}" + - name: Configure air source install + when: + - air_install_method == 'source' + block: + - name: Set air install package + ansible.builtin.set_fact: + air_go_pkg: + url: "{{ air_install_url }}@{{ air_version }}" + bin: "{{ path_bin }}/air" +# }}} + - name: Append air to pkg_go + when: + - air_install_method == 'source' + block: + - name: Clean existing air install + when: + - clean_install + loop: air_build_files + loop_control: + lopo_var: air_file + ansible.builtin.file: + state: absent + path: "{{ install_prefix }}/{{ air_file }}" - - name: Set air install package - ansible.builtin.set_fact: - air_pkg: "{{ air_install_url }}@{{ air_version }}" + - name: Configure pkg dependencies + loop: "{{ air_pkg_deps }}" + loop_control: + loop_var: air_pkg_dep + ansible.builtin.include_tasks: "{{ air_pkg_dep }}" + + - name: Add air to install list + ansible.builtin.set_fact: + pkg_go: "{{ pkg_go + [air_go_pkg] }}" - name: Complete air configuration ansible.builtin.set_fact: __air_configured: true -# }}} -- name: Append air to pkg_go - when: - - air_install_method == 'source' - ansible.builtin.set_fact: - pkg_go: "{{ pkg_go + [air_pkg] }}" diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index 1b56398..f6d4a37 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -2,29 +2,21 @@ --- - name: Configure alacritty # {{{ when: - - __alacritty_configured is undefined or - not __alacritty_configured + - __alacritty_configured is undefined block: - - name: Set install method + - name: Set alacritty install method when: - alacritty_install_method is undefined ansible.builtin.set_fact: alacritty_install_method: "{% if default_install_method in alacritty_install_methods %}{{ default_install_method }}{% else %}{{ alacritty_install_methods[0] }}{% endif %}" - - name: Set basic variables - ansible.builtin.set_fact: - alacritty_version: "{{ alacritty_version | default('v0.16.1') }}" - alacritty_git_repo: "{{ alacritty_git_repo | default('https://github.com/alacritty/alacritty') }}" - alacritty_pkgname: "{{ alacritty_pkgname | default('alacritty') }}" - alacritty_build_deps_extra: [] - - name: Configure alacritty source install when: - alacritty_install_method == "source" ansible.builtin.set_fact: + alacritty_build_deps: "{{ alacritty_build_deps[ansible_os_family] }}" alacritty_src_install: - cargo_build_flags: - - --release + cargo_build_flags: "{{ alacritty_cargo_build_flags }}" name: "{{ alacritty_pkgname }}" repo: "{{ alacritty_git_repo }}" version: "{{ alacritty_version }}" @@ -35,55 +27,7 @@ extra/logo/alacritty-term.svg: share/pixmaps/Alacritty.svg desktop_files: - extra/linux/Alacritty.desktop - files_list: - - bin/alacritty - - share/pixmaps/Alacritty.svg - alacritty_build_deps: - RedHat: - - cmake - - fontconfig-devel - - freetype-devel - - g++ - - libxcb-devel - - libxkbcommon-devel - - desktop-file-utils - Debian: - - cmake - - g++ - - pkg-config - - libfontconfig1-dev - - libxcb-xfixes0-dev - - libxkbcommon-dev - - python3 - - libfreetype6-dev - - desktop-file-utils - Alpine: - - cmake - - pkgconf - - freetype-dev - - fontconfig-dev - - python3 - - libxcb-dev - - g++ - - libxkbcommon-dev - - desktop-file-utils - Archlinux: - - cmake - - freetype2 - - fontconfig - - pkg-config - - make - - libxcb - - libxkbcommon - - python - - desktop-file-utils - FreeBSD: - - cmake - - freetype2 - - fontconfig - - pkgconf - - python3 - - desktop-file-utils + files_list: "{{ alacritty_build_files }}" - name: Set alacritty install extra build deps when: @@ -95,27 +39,29 @@ when: - ansible_distribution_major_version == 7 ansible.builtin.set_fact: - alacritty_build_deps_extra: ['xcb-util-devel', '@Development Tools'] + alacritty_build_deps: "{{ alacritty_build_deps + ['xcb-util-devel', '@Development Tools'] }}" - name: Add extra dependencies for EL8 when: - ansible_distribution_major_version == 8 ansible.builtin.set_fact: - alacritty_build_deps_extra: ['@Development Tools'] - - - name: Complete alacritty configuration - when: __alacritty_configured is undefined - ansible.builtin.set_fact: - __alacritty_configured: true + alacritty_build_deps: "{{ alacritty_build_deps + ['@Development Tools'] }}" # }}} -- name: Append alacritty installation - block: - - name: Append alacritty to pkg_cargo - when: - - alacritty_method == 'source' + - name: Append alacritty installation + block: + - name: Append alacritty to pkg_cargo + when: + - alacritty_method == 'source' + block: + - name: Configure pkg dependencies + loop: "{{ alacritty_pkg_deps }}" + loop_control: + loop_var: alacritty_pkg_dep + ansible.builtin.include_tasks: "{{ alacritty_pkg_dep }}" + ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + alacritty_build_deps + alacritty_build_deps_extra + ['git'] }}" + pkg_sys: "{{ pkg_sys + alacritty_build_deps }}" pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}" - name: Append alacritty to pkg_cask @@ -129,3 +75,8 @@ - alacritty_method == 'package' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + [alacritty_pkgname] }}" + + - name: Complete alacritty configuration + when: __alacritty_configured is undefined + ansible.builtin.set_fact: + __alacritty_configured: true diff --git a/tasks/pkgs/aquamarine.yml b/tasks/pkgs/aquamarine.yml index 77e355f..0eeb4c0 100644 --- a/tasks/pkgs/aquamarine.yml +++ b/tasks/pkgs/aquamarine.yml @@ -2,11 +2,49 @@ --- - name: Add aquamarine when: - - aquamarine_configured is undefined + - __aquamarine_configured is undefined block: - - name: Load aquamarine config - ansible.builtin.include_tasks: - file: config/aquamarine.yml + - name: Set aquamarine install method + when: + - aquamarine_install_method is undefined + ansible.builtin.set_fact: + aquamarine_install_method: "{% if install_method in aquamarine_install_methods %}{{ install_method }}{% else %}{{ aquamarine_install_methods[0] }}{% endif %}" + + - name: Configure aquamarine source install + when: + - aquamarine_install_method == 'source' + ansible.builtin.set_fact: + aquamarine_git_repo: + aquamarine_build_steps: + configure: + - cmake + - --no-warn-unused-cli + - -DCMAKE_BUILD_TYPE=Release + - -DCMAKE_INSTALL_PREFIX={{ install_prefix }} + - -S + - . + - -B + - ./build + build: + - cmake + - --build + - ./build + - --config + - Release + - --target + - all + - j + - "{{ build_jobs | int }}" + install: + - cmake + - --install + - ./build + + - name: Finish aquamarine configuration + when: + - __aquamarine_configured is undefined + ansible.builtin.set_fact: + __aquamarine_configured: true - name: Append aquamarine pkg_deps loop: "{{ aquamarine.pkg_deps }}" diff --git a/tasks/pkgs/go.yml b/tasks/pkgs/go.yml index 721da72..39068d2 100644 --- a/tasks/pkgs/go.yml +++ b/tasks/pkgs/go.yml @@ -16,20 +16,7 @@ block: - name: Configure go ansible.builtin.set_fact: - go_version: "{{ go_version | default('1.25.6') }}" go_system: "{{ ansible_system | lower }}" - go_archmap: - arm64: arm64 - aarch64: arm64 - x86_64: amd64 - go_install_sums: - 1.25.6: - Darwin: - amd64: sha256:e2b5b237f5c262931b8e280ac4b8363f156e19bfad5270c099998932819670b7 - arm64: sha256:984521ae978a5377c7d782fd2dd953291840d7d3d0bd95781a1f32f16d94a006 - Linux: - amd64: sha256:f022b6aad78e362bcba9b0b94d09ad58c5a70c6ba3b7582905fababf5fe0181a - arm64: sha256:738ef87d79c34272424ccdf83302b7b0300b8b096ed443896089306117943dd5 - name: Set go architecture ansible.builtin.set_fact: @@ -37,42 +24,44 @@ - name: Set archive name ansible.builtin.set_fact: - go_archive: "go{{ go_version }}.{{ go_system }}-{{ go_arch }}.tar.gz" + go_archive_file: "go{{ go_archive_version }}.{{ go_system }}-{{ go_arch }}.tar.gz" - - name: Set go download url + - name: Set go archive url and path ansible.builtin.set_fact: - go_archive_url: "https://go.dev/dl/{{ go_archive }}" + go_archive_url: "https://go.dev/dl/{{ go_archive_file }}" + go_extract_path: "{{ path_archive }}/go{{ go_archive_version }}" - - name: Set archive extract location - ansible.builtin.set_fact: - go_extract_path: "{{ path_archive }}/go{{ go_version }}" - - - name: Complete go archive install configuration - ansible.builtin.set_fact: - __go_configured: true + - name: Finalize go archive install + ansible.builtin.set_fact go_archive_install: extract_path: "{{ go_extract_path }}" archive_url: "{{ go_archive_url }}" archive_name: "{{ go_archive }}" - archive_checksum: "{{ go_install_sums[go_version][ansible_system][go_arch] }}" + archive_checksum: "{{ go_archive_sums[go_archive_version][ansible_system][go_arch] }}" -- name: Install vis system package manager - when: - - go_install_method == 'system' - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + ['go'] }}" + - name: Queue go install + block: + - name: Go system package install + when: + - go_install_method == 'system' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['go'] }}" -- name: Install via archive - when: - - go_install_method == 'archive' - block: - - name: Add go archive extract install + - name: Install via archive + when: + - go_install_method == 'archive' + block: + - name: Add go archive extract install + ansible.builtin.set_fact: + pkg_archive: "{{ pkg_archive + [go_archive_install] }}" + + - name: Set symbolic link to archive path + ansible.bulitin.file: + state: link + force: true + path: "{{ path_go }}" + src: "{{ go_extract_path }}/go" + + - name: Complete go archive install configuration ansible.builtin.set_fact: - pkg_archive: "{{ pkg_archive + [go_archive_install] }}" - - - name: Set symbolic link to archive path - ansible.bulitin.file: - state: link - force: true - path: "{{ path_go }}" - src: "{{ got_extract_path }}/go" + __go_configured: true diff --git a/tasks/pkgs/hyprland.yml b/tasks/pkgs/hyprland.yml index 41479a8..c4e4db3 100644 --- a/tasks/pkgs/hyprland.yml +++ b/tasks/pkgs/hyprland.yml @@ -29,9 +29,9 @@ hyprland_build_steps: configure: - cmake - - --now-warn-unused-cli - - -DCMAKE_BUILD_TYPE:STRING=Release - - -DCMAKE_INSTALL_PREFIX:PATH={{ install_prefix }} + - --no-warn-unused-cli + - -DCMAKE_BUILD_TYPE=Release + - -DCMAKE_INSTALL_PREFIX={{ install_prefix }} - -S - . - -B @@ -39,7 +39,7 @@ build: - cmake - --bulid - - ./uild + - ./build - --config - Release - --target diff --git a/vars/main.yml b/vars/main.yml index a1311b6..e24bd02 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -51,3 +51,88 @@ pkg_sh: [] # use shell commands to install a package pkg_appimage: [] # appimages to install pkg_flatpak: [] # flatpak packages to install pkg_snap: [] # snpacraft.io packages + +# Per package variables +## {{{ air +air_version: latest +air_install_url: github.com/air-verse/air +air_pkg_deps: + - pkgs/go.yml +air_build_files: + - bin/air +# }}} +## {{{ alacritty +alacritty_version: v0.16.1 +alacritty_git_repo: https://github.com/alacritty/alacritty +alacritty_pkgname: alacritty +alacritty_pkg_deps: + - pkgs/git.yml + - pkgs/cargo.yml +alacritty_build_files: + - bin/alacritty + - share/pixmaps/Alacritty.svg + - share/applications/Alacritty.desktop +alacritty_cargo_build_flags: + - --release +alacritty_build_deps: + RedHat: + - cmake + - fontconfig-devel + - freetype-devel + - g++ + - libxcb-devel + - libxkbcommon-devel + - desktop-file-utils + Debian: + - cmake + - g++ + - pkg-config + - libfontconfig1-dev + - libxcb-xfixes0-dev + - libxkbcommon-dev + - python3 + - libfreetype6-dev + - desktop-file-utils + Alpine: + - cmake + - pkgconf + - freetype-dev + - fontconfig-dev + - python3 + - libxcb-dev + - g++ + - libxkbcommon-dev + - desktop-file-utils + Archlinux: + - cmake + - freetype2 + - fontconfig + - pkg-config + - make + - libxcb + - libxkbcommon + - python + - desktop-file-utils + FreeBSD: + - cmake + - freetype2 + - fontconfig + - pkgconf + - python3 + - desktop-file-utils +# }}} +# go {{{ +go_archive_version: 1.25.6 +go_archive_archmap: + arm64: arm64 + aarch64: arm64 + x86_64: amd64 +go_archive_sums: + 1.25.6: + Darwin: + amd64: sha256:e2b5b237f5c262931b8e280ac4b8363f156e19bfad5270c099998932819670b7 + arm64: sha256:984521ae978a5377c7d782fd2dd953291840d7d3d0bd95781a1f32f16d94a006 + Linux: + amd64: sha256:f022b6aad78e362bcba9b0b94d09ad58c5a70c6ba3b7582905fababf5fe0181a + arm64: sha256:738ef87d79c34272424ccdf83302b7b0300b8b096ed443896089306117943dd5 +# }}} diff --git a/vars/pkglist.yml b/vars/pkglist.yml index aa457f2..a663d2c 100644 --- a/vars/pkglist.yml +++ b/vars/pkglist.yml @@ -17,9 +17,10 @@ ansible_lint_install_methods: ansible_install_methods: - system - system_pip -# hyprland packages aquamarine_install_methods: - source +hyprland_install_methods: + - source yazi_install_methods: - source - cargo