Date:
Estimated Time:less than a minute
Easy neovim with nix
In this post, I will show how to maintain a neovim configuration with the nix package manager. Nix can be installed on any linux distribution with a single sudo bash script.
One of the good point is it ease the way to install and configure softwares: below is an example on how to install neomutt and several vim packages. In case a package does not yet exists or is not up-to-date, the nixpkgs github repository is the place to make pull requests.
In case the merge is accepted, the nix unstable channel will get the modification few hours later, and any body is able to install the package.
Nix is well documented and the community looks extraordinary active. However the syntax and what happens behind the scene is for now a source of curiosity for me: I have not yet switch to nixos, and only be using the nix manager on few servers.
Still some packages are bogus, but things looks moving fast and I such active community makes the invest confident.
# .config/nixpkgs/config.nix
{= pkgs: with pkgs; rec {
packageOverrides = neovim.override {
myNeovim = true;
vimAlias = {
configure = ''
customRC
colo murphy
set number=utf-8
set encodingFileType python setlocal formatprg=autopep8\ -
au
! DoPrettyXML()
functionlet l:origft = &ft
=
set ft/<?xml .*?>//e
1s='<PrettyXML>'
0put $put ='</PrettyXML>'
%!xmllint --format -
silent
2d$d
1
"set ft=" . l:origft
exe
endfunction! PrettyXML call DoPrettyXML()
command
'';.myVimPackage = with pkgs.vimPlugins; {
packages= [
start
airline-nix
vim
molokai
tagbar
easymotion
nerdtree-vim
readline
];= [ ];
opt
};
};
};= pkgs.buildEnv {
myPackages = "myPackages";
name = [
paths
myNeovim
vlc
];
};
}; }
# it is possible to refresh the channels
nix-channel --update
# it is possible to install an apply both vimrc/packages from this command:
nix-env -i myPackages
# it is possible to remove this by doing
nix-env -e myPackages