From 61a869a1f5291bb30717c7c343bd0e4b738efa93 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Fri, 3 Nov 2017 02:34:42 +0900 Subject: [PATCH] neovim: add module This is a basic module that allows to configure different Neovim providers than the system ones. Note, it does not generate any `init.vim`. --- modules/default.nix | 1 + modules/misc/news.nix | 6 +++ modules/programs/neovim.nix | 74 +++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 modules/programs/neovim.nix diff --git a/modules/default.nix b/modules/default.nix index f82cfdbbc..7c67887cb 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -35,6 +35,7 @@ let ./programs/info.nix ./programs/lesspipe.nix ./programs/man.nix + ./programs/neovim.nix ./programs/rofi.nix ./programs/ssh.nix ./programs/termite.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 44b9d7f59..b177d6ce4 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -442,6 +442,12 @@ in December 6, 2017. ''; } + { + time = "2017-11-12T00:18:59+00:00"; + message = '' + A new program module is available: 'programs.neovim'. + ''; + } ]; }; } diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix new file mode 100644 index 000000000..8e0663f60 --- /dev/null +++ b/modules/programs/neovim.nix @@ -0,0 +1,74 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.neovim; + +in + +{ + options = { + programs.neovim = { + enable = mkEnableOption "Neovim"; + + withPython = mkOption { + type = types.bool; + default = true; + description = '' + Enable Python 2 provider. Set to true to + use Python 2 plugins. + ''; + }; + + extraPythonPackages = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExample "with pkgs.python2Packages; [ pandas jedi ]"; + description = '' + List here Python 2 packages required for your plugins to + work. + ''; + }; + + withRuby = mkOption { + type = types.nullOr types.bool; + default = true; + description = '' + Enable ruby provider. + ''; + }; + + withPython3 = mkOption { + type = types.bool; + default = true; + description = '' + Enable Python 3 provider. Set to true to + use Python 3 plugins. + ''; + }; + + extraPython3Packages = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExample + "with pkgs.python3Packages; [ python-language-server ]"; + description = '' + List here Python 3 packages required for your plugins to work. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ + (pkgs.neovim.override { + inherit (cfg) + extraPython3Packages withPython3 + extraPythonPackages withPython + withRuby; + }) + ]; + }; +}