 { config, lib, pkgs, ... }:
 
 let
   cfg = config.sydnix.users.crumb.nvim;
 in {
   options.sydnix.users.crumb.nvim.enable =
     lib.mkEnableOption "Neovim, à la crumb";
   config = lib.mkIf cfg.enable (
     let
       my-vimrc =
         pkgs.writeTextFile {
           name = "vimrc";
           text = ''
             imap jk <ESC>
             xmap JK <ESC>
             set number
             set relativenumber
             let mapleader=" "
             nmap <Leader>w <C-w>
             set splitright
           '';
         };
 
       my-neovim =
         pkgs.symlinkJoin {
           name = "neovim";
           paths = [ pkgs.neovim ];
           buildInputs = [ pkgs.makeWrapper ];
           postBuild = ''
             wrapProgram $out/bin/nvim \
               --add-flags "-u ${my-vimrc}"
             # Symlink {v,vi,vim} to nvim.
             for i in {v,vi,vim}; do
               ln -s $out/bin/nvim $out/bin/$i
             done
           '';
         };
     in {
       home.packages = [ my-neovim ];
     });
 }
 
