diff --git a/tasks/facts.yml b/tasks/facts.yml index ea419d5..8cb1acc 100644 --- a/tasks/facts.yml +++ b/tasks/facts.yml @@ -11,7 +11,7 @@ os_version: major: "{{ ansible_facts['distribution_major_version'] }}" version: "{{ ansible_facts['distribution_version'] }}" - release: "{{ ansible_facts['release'] }}" + release: "{{ ansible_facts['distribution_release'] }}" - name: Set package_home_base for Darwin when: diff --git a/tasks/helpers/cargo.yml b/tasks/helpers/cargo.yml index 4a0d11f..d6ce129 100644 --- a/tasks/helpers/cargo.yml +++ b/tasks/helpers/cargo.yml @@ -1,10 +1,14 @@ # vim: set filetype=yaml.ansible --- -- name: Install cargo +- name: Dump install vars + ansible.builtin.debug: + var: pkg + +- name: Install with cargo become: "{{ install_become }}" become_user: "{{ install_become_user }}" community.general.cargo: - name: "{{ cargo.name }}" - version: "{{ cargo.version | default(omit) }}" - locked: "{{ cargo.locked | default(false) }}" + name: "{{ pkg.name }}" + version: "{{ pkg.version | default(omit) }}" + locked: "{{ pkg.locked | default(false) }}" path: "{{ install_prefix }}" diff --git a/tasks/helpers/cargo_build.yml b/tasks/helpers/cargo_build.yml index 6dd2ba8..4f68055 100644 --- a/tasks/helpers/cargo_build.yml +++ b/tasks/helpers/cargo_build.yml @@ -4,22 +4,22 @@ block: - name: Fetch git repo vars: - path: "{{ path_source }}/{{ cargo_build.source_dir }}" - repo: "{{ cargo_build.repo }}" - depth: "{{ cargo_build.depth | default(1) }}" - force: "{{ cargo_build.force_git | default(true) }}" - recursive: "{{ cargo_build.recursive | default(true) }}" - version: "{{ cargo_build.version | default(omit) }}" + path: "{{ path_source }}/{{ pkg.source_dir }}" + repo: "{{ pkg.repo }}" + depth: "{{ pkg.depth | default(1) }}" + force: "{{ pkg.force_git | default(true) }}" + recursive: "{{ pkg.recursive | default(true) }}" + version: "{{ pkg.version | default(omit) }}" ansible.builtin.include_tasks: helpers/git.yml - name: Build cargo release ansible.builtin.command: - chdir: "{{ path_source }}/{{ cargo_build.source_dir }}" - argv: "{{ [cargo, build] + cargo_build.build_flags }}" + chdir: "{{ path_source }}/{{ pkg.source_dir }}" + argv: "{{ [cargo, build] + pkg.build_flags }}" - name: Clean existing install vars: - files: "{{ cargo_build.files }}" + files: "{{ pkg.files }}" ansible.builtin.include_tasks: helpers/clean.yml - name: Install cargo release @@ -28,5 +28,5 @@ become: "{{ install_become }}" become_user: "{{ install_become_user }}" vars: - source_dir: "{{ cargo_build.source_dir }}" + source_dir: "{{ pkg.source_dir }}" ansible.builtin.include_tasks: helpers/install.yml diff --git a/tasks/helpers/git.yml b/tasks/helpers/git.yml index e6629a3..e1ccbdf 100644 --- a/tasks/helpers/git.yml +++ b/tasks/helpers/git.yml @@ -1,4 +1,14 @@ # 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: diff --git a/tasks/helpers/make.yml b/tasks/helpers/make.yml new file mode 100644 index 0000000..edb2e0a --- /dev/null +++ b/tasks/helpers/make.yml @@ -0,0 +1,23 @@ +# 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 make targets + loop: "{{ pkg.targets }}" + loop_control: + loop_var: target + become: "{{ target.do_become }}" + community.general.make: + chdir: "{{ pkg.path }}" + target: "{{ target.name }}" + params: "{{ target.params | default(omit) }}" diff --git a/tasks/helpers/npm.yml b/tasks/helpers/npm.yml index ff42439..6864921 100644 --- a/tasks/helpers/npm.yml +++ b/tasks/helpers/npm.yml @@ -1,5 +1,8 @@ # 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 }}" diff --git a/tasks/main.yml b/tasks/main.yml index 4678303..5734f99 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -76,23 +76,20 @@ - name: Install go if required when: - pkg_go|length > 0 - ansible.builtin.include_tasks: - file: pkgs/go.yml + ansible.builtin.include_tasks: pkgs/go.yml - name: Install rust and cargo if required when: - pkg_cargo|length > 0 or pkg_cargo_build|length > 0 - ansible.builtin.include_tasks: - file: pkgs/rust.yml + ansible.builtin.include_tasks: pkgs/rust.yml - name: Ensure pipx is installed when: - pkg_pipx|length > 0 block: - name: Queue pipx install - ansible.builtin.include_tasks: - file: pkgs/pipx.yml + ansible.builtin.include_tasks: pkgs/pipx.yml - name: Ensure pipx path exists become: "{{ install_become }}" @@ -105,15 +102,13 @@ - name: Ensure nodejs and npm are installed when: - pkg_npm|length > 0 - ansible.builtin.include_tasks: - file: pkgs/nodejs.yml + ansible.builtin.include_tasks: pkgs/nodejs.yml - name: Ensure flatpak is installed when: - pkg_flatpak is defined - pkg_flatpak|length > 0 - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml + ansible.builtin.include_tasks: pkgs/flatpak.yml - name: Ensure appimage path exists when: @@ -139,8 +134,7 @@ - name: Depend zig when: - pkg_zig|length > 0 - ansible.builtin.include_tasks: - file: pkgs/zig.yml + ansible.builtin.include_tasks: pkgs/zig.yml - name: Install pkg_sys list using system package manager when: @@ -157,50 +151,34 @@ loop: "{{ pkg_archive }}" loop_control: loop_var: archive - ansible.builtin.include_tasks: - file: helpers/archive.yml + ansible.builtin.include_tasks: helpers/archive.yml - name: Linux specific tasks when: - system == 'Linux' - ansible.builtin.include_tasks: - file: linux.yml + ansible.builtin.include_tasks: linux.yml - name: MacOS specific tasks when: - distribution == 'MacOSX' - ansible.builtin.include_tasks: - file: macos.yml + ansible.builtin.include_tasks: macos.yml - name: Install cargo packages when: - - pkg_cargo|length > 0 + - pkg_cargo|length > 0 or + pkg_cargo_build|length > 0 block: - - name: Ensure cargo path exists - become: "{{ install_become }}" - become_user: "{{ install_become_user }}" - ansible.builtin.file: - state: directory - mode: '0755' - path: "{{ path_cargo }}" - - name: Install cargo packages loop: "{{ pkg_cargo | unique }}" loop_control: - loop_var: cargo - ansible.builtin.include_tasks: - file: helpers/cargo.yml + loop_var: pkg + ansible.builtin.include_tasks: helpers/cargo.yml -- name: Build and install rust apps - when: - - pkg_cargo_build|length > 0 - block: - - name: Run cargo build and install - loop: "{{ cargo_pkg_build }}" + - name: Install cargo_build packages + loop: "{{ pkg_cargo_build }}" loop_control: - loop_var: cargo_build - ansible.builtin.include_tasks: - file: helpers/cargo_build.yml + loop_var: pkg + ansible.builtin.include_tasks: helpers/cargo_build.yml - name: Install go packages when: @@ -210,8 +188,7 @@ loop: "{{ pkg_go }}" loop_control: loop_var: pkg - ansible.builtin.include_tasks: - file: helpers/go_install.yml + ansible.builtin.include_tasks: helpers/go_install.yml - name: Install local npm packages when: @@ -219,8 +196,7 @@ loop: "{{ pkg_npm | unique }}" loop_control: loop_var: pkg - ansible.builtin.include_tasks: - file: npm.yml + ansible.builtin.include_tasks: helpers/npm.yml - name: Install python pipx packages for user when: @@ -228,14 +204,16 @@ loop: "{{ pkg_pipx | unique }}" loop_control: loop_var: pkg - ansible.builtin.include_tasks: - file: pipx.yml + ansible.builtin.include_tasks: helpers/pipx.yml -- name: Build and install source packages +- name: Build and install make packages when: - - pkg_src|length > 0 - loop: "{{ pkg_src | unique }}" + - pkg_make|length > 0 + loop: "{{ pkg_make | unique }}" loop_control: loop_var: pkg - ansible.builtin.include_tasks: - file: "src/{{ pkg }}.yml" + ansible.builtin.include_tasks: helpers/make.yml + +- name: Dump __configured + ansible.builtin.debug: + var: __configured diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index 4b8b165..9a0bf2b 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -8,7 +8,6 @@ # Helpers: # - cargo_build --- - # {{{ Configure alacritty - name: Start alacritty configuration when: - "'alacritty' not in __configured" @@ -19,7 +18,7 @@ ansible.builtin.set_fact: alacritty_install_method: "{{ install_method if install_method in alacritty.install_methods else alacritty.install_methods[0] }}" - - name: Configure alacritty source install + - name: Configure alacritty source install # {{{ when: - alacritty_install_method == "source" block: @@ -50,29 +49,24 @@ ansible.builtin.set_fact: alacritty_build_deps: "{{ build_deps + ['@Development Tools'] }}" -# }}} - - name: Append alacritty installation - block: - - name: Append alacritty to pkg_cargo_build - when: - - alacritty_method == 'source' - block: - - name: Configure pkg dependencies - loop: "{{ alacritty.pkg_deps }}" - loop_control: - loop_var: dep - ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml" + - name: Configure pkg dependencies + loop: "{{ alacritty.pkg_deps }}" + loop_control: + loop_var: dep + ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml" - name: Append build dependencies and cargo config ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + alacritty_build_deps }}" pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}" - - - name: Append alacritty to pkg_sys +# }}} + - name: Configure alacritty system install when: - - alacritty_method == 'system' - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + [alacritty_pkgname] }}" + - alacritty_install_method == 'system' + block: + - name: Queue alacritty for installation + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + [alacritty_pkgname] }}" - name: Complete alacritty configuration ansible.builtin.set_fact: diff --git a/tasks/pkgs/ansible.yml b/tasks/pkgs/ansible.yml index 4e80eba..254bcfc 100644 --- a/tasks/pkgs/ansible.yml +++ b/tasks/pkgs/ansible.yml @@ -8,7 +8,7 @@ when: - ansible_install_method is undefined ansible.builtin.set_fact: - ansible_install_method: "{% if install_method in ansible_install_methods %}{{ install_method }}{% else %}{{ ansible_install_methods[0] }}{% endif %}" + ansible_install_method: "{{ install_method if install_method in ansible_install_methods else ansible_install_methods[0] }}" - name: Append ansible to system package manager install list when: diff --git a/tasks/pkgs/ansible_lint.yml b/tasks/pkgs/ansible_lint.yml index 4e3a82c..9bfbafd 100644 --- a/tasks/pkgs/ansible_lint.yml +++ b/tasks/pkgs/ansible_lint.yml @@ -30,4 +30,4 @@ - name: Complete ansible_lint configuration ansible.builtin.set_fact: - __configured: "{{ __configured | combine( { 'ansible_lint': true } ) }}" + __configured: "{{ __configured | combine( { 'ansible_lint': ansible_lint_install_method } ) }}" diff --git a/tasks/pkgs/ansible_ls.yml b/tasks/pkgs/ansible_ls.yml index 7c53381..1eb299c 100644 --- a/tasks/pkgs/ansible_ls.yml +++ b/tasks/pkgs/ansible_ls.yml @@ -8,22 +8,22 @@ when: - ansible_ls_install_method is undefined ansible.builtin.set_fact: - ansible_ls_install_method: "{{ install_method if install_method in ansible_ls_install_methods else ansible_ls_install_methods[0] }}" + ansible_ls_install_method: "{{ install_method if install_method in ansible_ls.install_methods else ansible_ls.install_methods[0] }}" - - name: Append ansible-language-server to pkg_npm + - name: Configure ansible_ls source install when: - ansible_ls_install_method == 'source' block: - name: Load required installation dependencies loop: "{{ ansible_ls_pkg_deps }}" loop_control: - loop_var: pkgdep - ansible.builtin.include_tasks: "{{ pkgdep }}" + loop_var: dep + ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml" - name: Append ansible ls to pkg_npm ansible.builtin.set_fact: - pkg_npm: "{{ pkg_npm + [ansible_npm_pkg] }}" + pkg_npm: "{{ pkg_npm + [ansible_ls.npm_pkg] }}" - name: Set ansible_ls_configured ansible.builtin.set_fact: - __configured: "{{ __configured | combine( { 'ansible_ls': true } ) }}" + __configured: "{{ __configured | combine( { 'ansible_ls': ansible_ls_install_method } ) }}" diff --git a/tasks/pkgs/bashls.yml b/tasks/pkgs/bashls.yml index 135ba18..2bb9c5f 100644 --- a/tasks/pkgs/bashls.yml +++ b/tasks/pkgs/bashls.yml @@ -8,14 +8,16 @@ when: - bashls_install_method is undefined ansible.builtin.set_fact: - bashls_install_method: "{{ install_method if install_method in bashls_install_methods else bashls_install_methods[0] }}" + bashls_install_method: "{{ install_method if install_method in bashls.install_methods else bashls.install_methods[0] }}" - - name: Append bash-language-server to pkg_npm + - name: Configure bashls source install when: - bashls_install_method == 'source' - ansible.builtin.set_fact: - pkg_npm: "{{ pkg_npm + [bashls_npm_pkgname] }}" + block: + - name: Append bashls to pkg_npm + ansible.builtin.set_fact: + pkg_npm: "{{ pkg_npm + [bashls.npm_pkg] }}" - name: Set bashls_configured ansible.builtin.set_fact: - __configured: "{{ __configured | combine( { 'bashls': true } ) }}" + __configured: "{{ __configured | combine( { 'bashls': bashls_install_method } ) }}" diff --git a/tasks/pkgs/cmake.yml b/tasks/pkgs/cmake.yml index 2a0b3a0..cdb2505 100644 --- a/tasks/pkgs/cmake.yml +++ b/tasks/pkgs/cmake.yml @@ -1,5 +1,23 @@ # vim: set filetype=yaml.ansible : --- -- name: Append cmake to pkg_sys - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + ['cmake'] }}" +- name: Configure cmake + when: + - "'cmake' not in __configured" + block: + - name: Set cmake install method + when: + - cmake_install_method is undefined + ansible.builtin.set_fact: + cmake_install_method: "{{ install_method if install_method in cmake.install_methods else cmake.install_methods[0] }}" + + - name: Configure cmake system install + when: + - cmake_install_method == "system" + block: + - name: Append cmake to pkg_sys + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['cmake'] }}" + + - name: Finalize cmake configuration + ansible.builtin.set_fact: + __configured: "{{ __configured | combine( { 'cmake': cmake_install_method } ) }}" diff --git a/tasks/pkgs/direnv.yml b/tasks/pkgs/direnv.yml index c10b521..f2edd27 100644 --- a/tasks/pkgs/direnv.yml +++ b/tasks/pkgs/direnv.yml @@ -8,7 +8,7 @@ when: - direnv_install_method is undefined ansible.builtin.set_fact: - direnv_install_method: "{{ install_method if install_method in direnv_install_methods else direnv_install_methods[0] }}" + direnv_install_method: "{{ install_method if install_method in direnv.install_methods else direnv.install_methods[0] }}" - name: Append direnv to pkg_sys when: @@ -18,4 +18,4 @@ - name: Finalize direnv configuration ansible.builtin.set_fact: - __configured: "{{ __configured | combine( { 'direnv': true } ) }}" + __configured: "{{ __configured | combine( { 'direnv': direnv_install_method } ) }}" diff --git a/tasks/pkgs/eza.yml b/tasks/pkgs/eza.yml index 1061a98..dbc0d62 100644 --- a/tasks/pkgs/eza.yml +++ b/tasks/pkgs/eza.yml @@ -1,13 +1,28 @@ # vim: set filetype=yaml.ansible : --- -- name: Add eza +- name: Configure eza when: - - eza_configured is undefined + - "'eza' not in __configured" block: - - name: Append eza to pkg_cargo + - name: Set eza install method + when: + - eza_install_method is undefined ansible.builtin.set_fact: - pkg_cargo: "{{ pkg_cargo + ['eza'] }}" + eza_install_method: "{{ install_method if install_method in eza.install_methods else eza.install_methods[0] }}" - - name: Set eza_configured + - name: Configure eza source install + when: + - eza_install_method == "source" + block: + - name: Configure eza cargo facts + ansible.builtin.set_fact: + eza_cargo_install: + name: eza + + - name: Append eza to pkg_cargo + ansible.builtin.set_fact: + pkg_cargo: "{{ pkg_cargo + [eza_cargo_install] }}" + + - name: Finalized eza configuration ansible.builtin.set_fact: - eza_configured: true + __configured: "{{ __configured | combine( { 'eza': eza_install_method} ) }}" diff --git a/tasks/pkgs/fzf.yml b/tasks/pkgs/fzf.yml index 545410f..bec4d44 100644 --- a/tasks/pkgs/fzf.yml +++ b/tasks/pkgs/fzf.yml @@ -1,5 +1,23 @@ # vim: set filetype=yaml.ansible : --- -- name: Append fzf to pkg_sys - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + ['fzf'] }}" +- name: Configure fzf + when: + - "'fzf' not in __configured" + block: + - name: Set fzf install method + when: + - fzf_install_method is undefined + ansible.builtin.set_fact: + fzf_install_method: "{{ install_method if install_method in fzf.install_methods else fzf.install_methods[0] }}" + + - name: Configure fzf system install + when: + - fzf_install_method == "system" + block: + - name: Append fzf to pkg_sys + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['fzf'] }}" + + - name: Finalize fzf configuration + ansible.builtin.set_fact: + __configured: "{{ __configured | combine( { 'fzf': fzf_install_method } ) }}" diff --git a/tasks/pkgs/git.yml b/tasks/pkgs/git.yml index 33ce14b..6a6c941 100644 --- a/tasks/pkgs/git.yml +++ b/tasks/pkgs/git.yml @@ -1,9 +1,23 @@ # vim: set filetype=yaml.ansible : --- -- name: Load git config - ansible.builtin.include_tasks: - file: config/git.yml +- name: Configure git + when: + - "'git' not in __configured" + block: + - name: Set git install method + when: + - git_install_method is undefined + ansible.builtin.set_fact: + git_install_method: "{{ install_method if install_method in git.install_methods else git.install_methods[0] }}" -- name: Append git to pkg_sys - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + git.pkgs }}" + - name: Configure git system install + when: + - git_install_method == "system" + block: + - name: Append git to pkg_sys + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['git'] }}" + + - name: Finalize git configuration + ansible.builtin.set_fact: + __configured: "{{ __configured | combine( { 'git': git_install_method } ) }}" diff --git a/tasks/pkgs/go.yml b/tasks/pkgs/go.yml index 0608ad4..cee5b34 100644 --- a/tasks/pkgs/go.yml +++ b/tasks/pkgs/go.yml @@ -8,7 +8,7 @@ when: - go_install_method is undefined ansible.builtin.set_fact: - go_install_method: "{% if install_method in go_install_methods %}{{ install_method }}{% else %}{{ go_install_methods[0] }}{% endif %}" + go_install_method: "{{ install_method if install_method in go.install_methods else go.install_methods[0] }}" - name: Configure go system installation when: diff --git a/tasks/pkgs/neovim.yml b/tasks/pkgs/neovim.yml index 100da57..6294150 100644 --- a/tasks/pkgs/neovim.yml +++ b/tasks/pkgs/neovim.yml @@ -8,26 +8,38 @@ when: - neovim_install_method is undefined ansible.builtin.set_fact: - neovim_install_method: "{{ install_method if install_method in neovim_install_methods else neovim_install_methods[0] }}" -- name: Load neovim config - ansible.builtin.include_tasks: - file: config/neovim.yml + neovim_install_method: "{{ install_method if install_method in neovim.install_methods else neovim.install_methods[0] }}" -- name: Append neovim to pkg_appimage - when: - - neovim.method == 'appimage' - ansible.builtin.set_fact: - pkg_appimage: "{{ pkg_appimage + ['neovim'] }}" + - name: Configure neovim source install + when: + - neovim_install_method == "source" + block: + - name: Queue pkg build deps + when: + - neovim.build_pkgdeps is defined + loop: "{{ neovim.build_pkgdeps }}" + loop_control: + loop_var: dep + ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml" -- name: Append neovim to pkg_sys - when: - - neovim.method == 'sys' - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + ['neovim'] }}" + - name: Set helper facts + ansible.builtin.set_fact: + neovim_src_install: + path: "{{ d_cache.path }}/neovim" + repo: "{{ neovim.git_repo }}" + version: "{{ neovim_version }}" + targets: + - name: "" + do_become: false + params: + CMAKE_BUILD_TYPE: Release + CMAKE_EXTRA_FLAGS: "-DCMAKE_INSTALL_PREFIX={{ install_prefix }}" + - name: install + do_become: true + - name: Append neovim to source install list + ansible.builtin.set_fact: + pkg_make: "{{ pkg_make + [neovim_src_install] }}" -- name: Append neovim to pkg_src - when: - - neovim.method == 'src' - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + neovim.build_deps }}" - pkg_src: "{{ pkg_src + ['neovim'] }}" + - name: Finalized neovim configuration + ansible.builtin.set_fact: + __configured: "{{ __configured | combine( { 'neovim': neovim_install_method } ) }}" diff --git a/tasks/pkgs/nodejs.yml b/tasks/pkgs/nodejs.yml index 3405a9d..e221d54 100644 --- a/tasks/pkgs/nodejs.yml +++ b/tasks/pkgs/nodejs.yml @@ -1,9 +1,27 @@ # vim: set filetype=yaml.ansible : --- -- name: Load nodejs config - ansible.builtin.include_tasks: - file: config/nodejs.yml +- name: Configure nodejs + when: + - "'nodejs' not in __configured" + block: + - name: Set nodejs install method + when: + - nodejs_install_method is undefined + ansible.builtin.set_fact: + nodejs_install_method: "{{ install_method if install_method in nodejs.install_methods else nodejs.install_methods[0] }}" -- name: Append nodejs to pkg_sys - ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + nodejs.pkgs }}" + - name: Configure nodejs system install + when: + - nodejs_install_method == "system" + block: + - name: Set nodejs package name + ansible.builtin.set_fact: + nodejs_pkgname: "{{ nodejs.pkgname[system] }}" + nodejs_deps: "{{ nodejs.pkg_deps[system] | default([]) }}" + - name: Append nodejs to pkg_sys + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + [nodejs_pkgname] + nodejs_deps }}" + + - name: Finalize nodejs configuration + ansible.builtin.set_fact: + __configured: "{{ __configured | combine( { 'nodejs': nodejs_install_method } ) }}" diff --git a/tasks/pkgs/npm.yml b/tasks/pkgs/npm.yml new file mode 100644 index 0000000..b0cc098 --- /dev/null +++ b/tasks/pkgs/npm.yml @@ -0,0 +1,3 @@ +--- +- name: Include nodejs to satisfy npm + ansible.builtin.include_tasks: pkgs/nodejs.yml diff --git a/tasks/pkgs/rust.yml b/tasks/pkgs/rust.yml index a7d1a40..c804b3f 100644 --- a/tasks/pkgs/rust.yml +++ b/tasks/pkgs/rust.yml @@ -8,13 +8,7 @@ when: - rust_install_method is undefined ansible.builtin.set_fact: - rust_install_method: "{{ install_method if install_method in rust_install_methods else rust_install_methods[0] }}" - - - name: Add dependencies - loop: rust_pkgdeps - loop_control: - loop_var: dep - ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml" + rust_install_method: "{{ install_method if install_method in rust.install_methods else rust.install_methods[0] }}" - name: Append rust to install list when: diff --git a/tasks/pkgs/starship.yml b/tasks/pkgs/starship.yml index 2617c5e..d22e8c0 100644 --- a/tasks/pkgs/starship.yml +++ b/tasks/pkgs/starship.yml @@ -4,10 +4,26 @@ when: - "'starship' not in __configured" block: - - name: Append starship to pkg_cargo + - name: Set starship install method + when: + - starship_install_method is undefined ansible.builtin.set_fact: - pkg_cargo: "{{ pkg_cargo + [{'name': 'starship', 'locked': true}] }}" + starship_install_method: "{{ install_method if install_method in starship.install_methods else starship.install_methods[0] }}" - - name: Finalize startship configuration + - name: Configure starship source install + when: + - starship_install_method == "source" + block: + - name: Set cargo build options + ansible.builtin.set_fact: + starship_cargo_install: + name: starship + locked: true + version: "{{ starship_version | default(omit) }}" + - name: Append starship to pkg_cargo + ansible.builtin.set_fact: + pkg_cargo: "{{ pkg_cargo + [{'name': 'starship', 'locked': true}] }}" + + - name: Finalize starship configuration ansible.builtin.set_fact: - __configured: "{{ __configured | combine( { 'starship': true } ) }}" + __configured: "{{ __configured | combine( { 'starship': starship_install_method } ) }}" diff --git a/tasks/pkgs/zoxide.yml b/tasks/pkgs/zoxide.yml index fa22423..3fd8c27 100644 --- a/tasks/pkgs/zoxide.yml +++ b/tasks/pkgs/zoxide.yml @@ -8,7 +8,7 @@ when: - zoxide_install_method is undefined ansible.builtin.set_fact: - zoxide_install_method: "{{ install_method if intall_method in zoxide_install_methods else zoxide_install_methods[0] }}" + zoxide_install_method: "{{ install_method if install_method in zoxide.install_methods else zoxide.install_methods[0] }}" - name: Append zoxide to pkg_sys ansible.builtin.set_fact: @@ -16,4 +16,4 @@ - name: Set zoxide_configured ansible.builtin.set_fact: - __configured: "{{ __configured | combine( { 'zoxide': true } ) }}" + __configured: "{{ __configured | combine( { 'zoxide': zoxide_install_method } ) }}" diff --git a/tasks/pkgs/zsh.yml b/tasks/pkgs/zsh.yml index 0a7a0a3..ef34f14 100644 --- a/tasks/pkgs/zsh.yml +++ b/tasks/pkgs/zsh.yml @@ -7,8 +7,8 @@ - name: Set zsh install method when: - zsh_install_method is undefined - ansible.bulitin.set_fact: - zsh_install_method: "{{ install_method if install_method in zsh_install_methods else zsh_install_methods[0] }}" + ansible.builtin.set_fact: + zsh_install_method: "{{ install_method if install_method in zsh.install_methods else zsh.install_methods[0] }}" - name: Append zsh to pkg_sys when: diff --git a/vars/main.yml b/vars/main.yml index 63a46ac..bd778c8 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -31,6 +31,7 @@ pkg_cargo_build: [] # rust packages using `cargo build` before install pkg_clean: [] # list of files to remove before running archive and source installations pkg_flatpak: [] # flatpak packages to install pkg_go: [] # go applications +pkg_make: [] # use gnu make to build/install pkg_npm: [] # npm commands pkg_pipx: [] # pipx packages pkg_sh: [] # use shell commands to install a package @@ -84,8 +85,6 @@ ansible_ls_version: latest ansible_npm_pkg: name: '@ansible/ansible-language-server' global: true -ansible_ls_pkg_deps: - - pkgs/npm.yml # }}} # {{{ bashls bashls_install_methods: @@ -130,48 +129,6 @@ go_pkgname: # neovim {{{ neovim_version: master neovim_build_type: Release -neovim_git_repo: https://github.com/neovim/neovim -neovim_appimage: - base_url: https://github.com/neovim/neovim/releases/download - link_name: nvim -neovim_pkgname: - RedHat: neovim - Debian: neovim - Darwin: neovim - FreeBSD: neovim -neovim_build_deps: - RedHat: - - cmake - - curl - - gcc - - gettext - - glibc-gconv-extra - - make - - ninja-build - Debian: - - build-essential - - cmake - - curl - - gettext - - ninja-build - Darwin: - - cmake - - curl - - gettext - - ninja - Alpine: - - build-base - - cmake - - coreutils - - curl - - gettext-dev -neovim_build_files: - - lib64/nvim - - bin/nvim - - share/nvim - - share/applications/nvim.desktop - - share/icons/hicolor/128x128/apps/nvim.png - - share/man/man1/nvim.1 # }}} # {{{ nerdfonts nerdfonts_install_list: @@ -186,8 +143,6 @@ nerdfonts_install_path: share/fonts # }}} # rust {{{ rust_pkgname: rust -rust_pkgdeps: - - cargo # }}} # {{{ zsh zsh_base_url: git://git.code.sf.net/p/zsh/code diff --git a/vars/pkglist.yml b/vars/pkglist.yml index 7a4cdd5..c2677a9 100644 --- a/vars/pkglist.yml +++ b/vars/pkglist.yml @@ -91,10 +91,32 @@ ansible_ls: install_methods: - source - system + npm_pkg: + name: '@ansible/ansible-language-server' + global: true + pkg_deps: + - nodejs +# {{{ bashls +bashls: + install_methods: + - source + npm_pkg: + name: bash-language-server + global: true +# }}} +cargo: + install_methods: + - system +cmake: + install_methods: + - system direnv: install_methods: - system -cargo: +eza: + install_methods: + - source +fzf: install_methods: - system git: @@ -107,19 +129,77 @@ go: hyprland: install_methods: - source -neovim: +neovim: # {{{ + git_repo: https://github.com/neovim/neovim + appimage: + base_url: https://github.com/neovim/neovim/releases/download + pkgname: + RedHat: neovim + Debian: neovim + Darwin: neovim + FreeBSD: neovim + build_files: + - lib64/nvim + - bin/nvim + - share/nvim + - share/applications/nvim.desktop + - share/icons/hicolor/128x128/apps/nvim.png + - share/man/man1/nvim.1 + build_pkgdeps: + - cmake + - git + build_deps: + RedHat: + - cmake + - curl + - gcc + - gettext + - glibc-gconv-extra + - make + - ninja-build + Debian: + - build-essential + - cmake + - curl + - gettext + - ninja-build + Darwin: + - cmake + - curl + - gettext + - ninja + Alpine: + - build-base + - cmake + - coreutils + - curl + - gettext-dev install_methods: - source - system - appimage - archive +# }}} nerdfonts: install_methods: - archive - system +nodejs: + install_methods: + - system + pkgname: + Linux: nodejs + Darwin: node + pkg_deps: + Linux: + - npm + - sqlite rust: install_methods: - system +starship: + install_methods: + - source yazi: install_methods: - source @@ -130,7 +210,6 @@ zoxide: zsh: install_methods: - system - - source ## Package specific configuration that never need to be set by the installer __nerdfonts: # {{{