diff --git a/roles/nvim/defaults/main.yml b/roles/nvim/defaults/main.yml index ee970e8..0582197 100644 --- a/roles/nvim/defaults/main.yml +++ b/roles/nvim/defaults/main.yml @@ -1,2 +1,3 @@ --- # defaults file for nvim +nvim_git_url: https://github.com/neovim/neovim.git diff --git a/roles/nvim/tasks/install-nvim.yml b/roles/nvim/tasks/install-nvim.yml index 330904e..bc3222f 100644 --- a/roles/nvim/tasks/install-nvim.yml +++ b/roles/nvim/tasks/install-nvim.yml @@ -24,7 +24,7 @@ ansible.builtin.shell: | set pipefail # yamllint disable-line rule:line-length - NVIM_HEAD_VER="$(git ls-remote --tags https://github.com/neovim/neovim.git nightly \ + NVIM_HEAD_VER="$(git ls-remote --heads https://github.com/neovim/neovim.git master \ | awk '{ print $1 }' \ | head -c 9)" echo $NVIM_HEAD_VER >&2 @@ -38,64 +38,33 @@ nvim_install_needed: "{{ nvim_install_needed | default(true) }}" when: nvim_installed.rc == 0 and nvim_remote_version.stdout | default() != nvim_installed_version.stdout | default() -- name: Install neovim for MacOS - community.general.homebrew: - name: neovim - state: head - when: ansible_facts.distribution == 'MacOSX' - -- name: Handle neovim install for non-macos systems - when: ansible_facts.distribution != 'MacOSX' and nvim_install_needed is defined and nvim_install_needed is true +- name: Handle neovim install for Unix systems + # TODO: Actually limit the targetting of this to Unix systems + when: nvim_install_needed is defined and nvim_install_needed is true block: - name: Create working directory ansible.builtin.tempfile: state: directory + prefix: neovim-checkout- register: nvim_work_dir - - name: Set nvim url - ansible.builtin.set_fact: - # yamllint disable-line rule:line-length - nvim_url: "{{ 'https://github.com/neovim/neovim/releases/download/nightly/nvim-' + nvim_platform | default('linux64') + '.tar.gz' }}" + - name: Checkout Neovim Master from Git + # noqa latest + ansible.builtin.git: + repo: "{{ nvim_git_url }}" + dest: "{{ nvim_work_dir.path }}" + force: true + update: true - - name: Set nvim archive variables - ansible.builtin.set_fact: - nvim_checksum: "{{ 'sha256:' + nvim_url + '.sha256sum' }}" - nvim_archive_dest: "{{ nvim_work_dir.path + '/nvim.tar.gz' }}" - nvim_unpacked_dest: "{{ nvim_work_dir.path + '/nvim-unpacked' }}" + - name: Build Neovim + community.general.make: + chdir: "{{ nvim_work_dir.path }}" + params: + NUM_THREADS: 8 + CMAKE_BUILD_TYPE: Release - - name: Download neovim archive from releases + - name: Install Neovim become: true - ansible.builtin.get_url: - url: "{{ nvim_url }}" - checksum: "{{ nvim_checksum }}" - dest: "{{ nvim_archive_dest }}" - mode: "0644" - - - name: Create unpack directory - ansible.builtin.file: - state: directory - mode: "0644" - path: "{{ nvim_unpacked_dest }}" - - - name: Extract neovim archive - become: true - ansible.builtin.unarchive: - src: "{{ nvim_archive_dest }}" - dest: "{{ nvim_unpacked_dest }}" - remote_src: true - when: nvim_install_needed is defined and nvim_install_needed is true - - - name: Copy neovim files into place - become: true - # noqa command-instead-of-module - ansible.builtin.command: - argv: - - rsync - - -avPr - - "{{ nvim_unpacked_dest }}/nvim-{{ nvim_platform | default('linux64') }}/{{ item }}" - - "{{ nvim_sync_dest_dir | default('/usr/') }}" - changed_when: true - loop: - - bin - - lib - - share + community.general.make: + chdir: "{{ nvim_work_dir.path }}" + target: install