nvim_build

ansible role for neovim nightly build


Project maintained by klooj Hosted on GitHub Pages — Theme by mattgraham

CI Build Status

nvim_build

This ansible role builds the nightly version of neovim on macOS and debian based linux distributions.

First, it installs or updates the dependencies, packages, repos, and optional features used for building and configuring your neovim. Then, it builds neovim using the makefile from the source repo. This role puts everything in place but does not open neovim nor run arbitrary neovim commands, so it neither updates nor installs plugins. To use this role, add the following to your requirements file and run ansible-galaxy install klooj.nvim_build

If the galaxy install method is throwing errors, put the following in a reqs.yaml file and run ansible-galaxy install -f -r reqs.yml

- src: https://github.com/klooj/nvim_build

requirements

The are also a few optional dependencies listed below.

Role Variables

variable default directory description
nvim_build_dir /neovim local dest for clone of source repo
nvim_dir /.config/nvim local dest for clone of user config
nvim_source neovim/neovim build source repo
nvrc_repo   personal config repo
install_path ~/.local dest for installed runtime files & binary

The default for nearly everything is non-action.

variable default description type
daily_limit yes do not build if successfully built less than a day ago (nvim,lsp) bool
build_it no whether to build and install nvim bool
exe_make   path to executable string
exe_shell   path to executable string
exe_pip   path to executable string
exe_yarn   path to executable string
exe_gem   path to executable string
git_key   path to host key when using ssh for pulls/clones string
git_method https only supported options are ssh and https string
gits_dir ~/gits local parent directory where extra repos are cloned string
gits   format: [- name: any, repo: foo/bar] dict
lx_rtp_bin no whether to create “vim bin” at /usr/local/opt bool
lx_rtp_packs + symlinks into vimbin; format:[- name: fzf, source: ~/go/bin/fzf] dict
lsp_lua_lx no whether to install sumneko lua lsp linux bool
lsp_lua_mac no whether to install sumneko lua lsp mac bool
nv_dirs_mk no whether to create directories specified by nv_dirs bool
nv_dirs + folders to create; i.e., ~/.cache/nvim/undodir, etc. list

+ = see defaults/main.yml for default values


variable default type
install_apts no bool
apts see below list
install_brews no bool
brews see below list
brew_heads see below list
install_gems no bool
gems neovim, minitest-neovim list
install_cargos no (fd, rg, rga) bool
install_perls no bool
perls Neovim list
install_pips no bool
install_yarns no bool

apt apt brew
ack libtool ack
autoconf libtool-bin automake
automake libunibilium-dev ccache
build-essential libutf8proc-dev cmake
ccache libuv1-dev fd
cmake libvterm-dev fzy
dirmngr lua5.3 gettext
ffmpeg luajit libtool
fzy luarocks lua
g++ ninja-build ninja
git pandoc pkg-config
git-lfs pkg-config rg
gettext poppler-utils rga
gperf software-properties-common fzf – HEAD
libluajit-5.1-dev unzip luajit – HEAD
libmsgpack-dev zsh luarocks – HEAD
libtermkey-dev    

NOTE

  1. I cannot get ansible’s cpanm module to function properly. If you would like perl + neovim integration, run this from the command line: cpanm Neovim::Ext
  2. pip and yarn2 install from requirements.txt/package.json files, respectively, instead of taking a list. Make sure those files are in your nvrc_repo or use a pre-task to put them in nvim_dir (see playbook example below).
  3. Only github is supported out of the box for cloning repos. I have never used gitlab or any other version control platform and do not know my way around.
  4. The lx_rtp_bin “vim bin” is a directory with the same absolute path on each machine that is not in $PATH, and I use it for symlinking binaries that I want to made specifically available to neovim. So, in vimrc I can just rtp+=/usr/local/opt/fzf once and forget about it.

Lua LSP

If you enable the lua lsp installation in this role, put the following code or its equivalent in your init.lua or a lua herestring in your init.vim . If you kept the default value of $HOME/gits for gits_dir, then:

local sumneko_binary
local sumneko_root_path =  os.getenv("HOME") .. "gits/lua-language-server"
if vim.fn.has("mac") == 1 then
  sumneko_binary = sumneko_root_path .. "/bin/macOS/lua-language-server"
elseif vim.fn.has("unix") == 1 then
   sumneko_binary = sumneko_root_path .. "/bin/Linux/lua-language-server"
end
...
require('lspconfig').sumneko_lua.setup {
    ...
    cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
    ...
}
...

dependencies

The dependencies are triggered in limited circumstances for certain optional features.

It is not required but is strongly recommended to get your virtual environment affairs in order before running this play.

Example Playbook

play/main.yml

---  
- hosts: all  

  pre_tasks:  
    - name: copy node package.json for yarn  
      copy:  
        src: files/package.json  
        dest: ""  
        force: no  
    - name: copy requirements.txt for pip  
      copy:  
        src: files/requirements.txt  
        dest: ""  
        force: no  

  vars:  
    nvrc_repo: klooj/nvim  

    build_it: yes  
    nv_dirs_mk: yes  

    gits_dir: "/gits"  
    git_key: "~/.ssh/_secretKey"  
    git_method: ssh  

    lsp_lua_lx: yes  
    lsp_lua_mac: yes  
    lx_rtp_bin: yes  

    install_brews: yes  
    install_apts: yes  
    install_pips: yes  
    exe_pip: ~/.pyenv/versions/neovim3.9/bin/pip  
    install_yarns: yes  
    exe_yarn: ~/.config/nvm/versions/node/v14.15.1/bin/yarn  
    install_gems: yes  

  roles:  
    - nvim_build  
...  

play/group_vars/macs.yml

---  
exe_make = /usr/local/gnubin/make  
exe_shell = /usr/local/bin/zsh  
exe_gem = /usr/local/opt/ruby/bin/gem  
...  

TODO

Author License
www.github.com/klooj MIT

  1. Compatability with earlier versions of ansible would only require a few task names to be modified. 

  2. npm was constantly throwing errors over things that no self-respecting package manager should, so right now this role uses yarn only … and I do not feel compelled to try reimplementing npm.