diff --git a/roles/neovim/meta/main.yml b/roles/neovim/meta/main.yml index b60b374..f37e184 100644 --- a/roles/neovim/meta/main.yml +++ b/roles/neovim/meta/main.yml @@ -1,3 +1,3 @@ -dependencies: - - role: common - - role: bash +# dependencies: +# - role: common +# - role: bash diff --git a/roles/neovim/tasks/main.yml b/roles/neovim/tasks/main.yml index df410fd..917571f 100644 --- a/roles/neovim/tasks/main.yml +++ b/roles/neovim/tasks/main.yml @@ -1,62 +1,119 @@ -- name: Download Neovim PPA signing key - become: true - apt_key: - keyserver: keyserver.ubuntu.com - id: 9DBB0BE9366964F134855E2255F96FCF8231B6DD - keyring: /etc/apt/trusted.gpg.d/neovim.gpg -- name: Install Neovim PPA - become: true - apt_repository: - repo: "deb [signed-by=/etc/apt/trusted.gpg.d/neovim.gpg] https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu {{ distribution_release }} main" - register: apt_repository -- name: Update APT cache - become: true - apt: - update_cache: true - when: apt_repository.changed -- name: Install Neovim - become: true - apt: - name: neovim +- name: Check if neovim is installed + command: + cmd: "which nvim" + failed_when: false + changed_when: false + register: which_nvim + +- name: Check local neovim version + command: + cmd: "nvim --version" + changed_when: false + check_mode: false + register: current_neovim_version + when: which_nvim.rc == 0 + +- name: Set local nvim version as fact if present + set_fact: + current_neovim_version: "{{ current_neovim_version.stdout_lines | default(['no version']) | first }}" + when: which_nvim.rc == 0 + +- name: Set local nvim version as fact if not present + set_fact: + current_neovim_version: "error" + when: which_nvim.rc != 0 + +- name: Get latest release version + uri: + url: "https://api.github.com/repos/neovim/neovim/releases/latest" + changed_when: false + check_mode: false + register: latest_stable_neovim_version + +- name: Set latest nvim stable version as fact + set_fact: + latest_stable_neovim_version: "{{ latest_stable_neovim_version.json.body.splitlines()[1] }}" + +- name: Diff latest release and currently installed + ansible.builtin.set_fact: + neovim_up_to_date: "{{ latest_stable_neovim_version == current_neovim_version }}" + +- name: Build neovim + when: not neovim_up_to_date + block: + - name: Pull neovim github repository + git: + repo: "https://github.com/neovim/neovim.git" + dest: "$HOME/repos/neovim" + update: true + version: stable + + - name: Compile neovim from source + make: + chdir: "$HOME/repos/neovim" + target: all + params: + CMAKE_BUILD_TYPE: RelWithDebInfo + + - name: Install neovim from source + make: + chdir: "/home/{{ ansible_user_id }}/repos/neovim" + target: install + become: true + + - name: Remove neovim git repo + file: + path: "$HOME/repos/neovim" + state: absent + - name: Create configuration directory file: path: ~/.config/nvim state: directory + - name: Copy init.lua copy: src: "{{ role_path }}/files/init.lua" dest: ~/.config/nvim/init.lua + - name: Create plugin directory file: path: ~/.config/nvim/plugin state: directory recurse: true + - name: Copy plugin configuration files copy: src: "{{ role_path }}/files/plugin/" dest: ~/.config/nvim/plugin + - name: Create lua directory file: path: ~/.config/nvim/lua state: directory recurse: true + - name: Copy lua files copy: src: "{{ role_path }}/files/lua/" dest: ~/.config/nvim/lua + - name: Install python-lsp-server pip: name: - "python-lsp-server[all]" + - name: Clone packer repository git: repo: https://github.com/wbthomason/packer.nvim depth: 1 dest: ~/.local/share/nvim/site/pack/packer/start/packer.nvim + - name: Install terraform-ls become: true apt: pkg: terraform-ls + - name: Set default applications ini_file: path: ~/.config/mimeapps.list @@ -65,6 +122,7 @@ value: "nvim.desktop" no_extra_spaces: true loop: "{{ default_apps }}" + - name: Copy neovim.bashrc copy: src: "{{ role_path }}/files/neovim.bashrc" diff --git a/roles/strawberry/templates/strawberry.conf.j2 b/roles/strawberry/templates/strawberry.conf.j2 index 127d755..8e08ffb 100644 --- a/roles/strawberry/templates/strawberry.conf.j2 +++ b/roles/strawberry/templates/strawberry.conf.j2 @@ -245,7 +245,7 @@ use_authentication=false username= [OSD] -Behaviour=3 +Behaviour=2 CustomText1=%title% CustomText2=%artist% - %album% CustomTextEnabled=true diff --git a/setup.yml b/setup.yml index f1ec18b..5dd004c 100644 --- a/setup.yml +++ b/setup.yml @@ -10,8 +10,8 @@ tags: [bash] - role: alacritty tags: [alacritty] - # - role: neovim - # tags: [neovim] + - role: neovim + tags: [neovim] - role: keepassxc tags: [keepassxc] - role: wireguard