From 7647353c40b5f662cc4d2e37f44b5fff2636fe94 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 21 Apr 2024 02:23:07 +0300 Subject: [PATCH] modules/wrapper: make all wrapper features configurable following features have been made configurable `withRuby`, `withNodeJs`, `withPython3` and `python3Packages` --- modules/default.nix | 5 +++-- modules/wrapper/build/options.nix | 30 +++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/modules/default.nix b/modules/default.nix index ee3f1fa..f840334 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -83,6 +83,7 @@ inputs: { plugins = builtStartPlugins ++ builtOptPlugins; extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages; + extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages; # wrap user's desired neovim package using the neovim wrapper from nixpkgs # the wrapper takes the following arguments: @@ -95,8 +96,8 @@ inputs: { # - customRC (string) # and returns the wrapped package neovim-wrapped = wrapNeovimUnstable vimOptions.package (makeNeovimConfig { - inherit (vimOptions) viAlias vimAlias; - inherit plugins extraLuaPackages; + inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3; + inherit plugins extraLuaPackages extraPython3Packages; customRC = vimOptions.builtConfigRC; }); in { diff --git a/modules/wrapper/build/options.nix b/modules/wrapper/build/options.nix index 09bcf1f..0004bda 100644 --- a/modules/wrapper/build/options.nix +++ b/modules/wrapper/build/options.nix @@ -3,7 +3,7 @@ lib, ... }: let - inherit (lib.options) mkOption literalExpression; + inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.types) package bool str listOf attrsOf; inherit (lib.nvim.types) pluginsOpt extraPluginType; in { @@ -94,6 +94,21 @@ in { ''; }; + # this defaults to `true` in the wrapper + # and since we passs this value to the wrapper + # with an inherit, it should be `true` here as well + withRuby = + mkEnableOption '' + Ruby support in the Neovim wrapper. + '' + // { + default = true; + }; + + withNodeJs = mkEnableOption '' + NodeJs support in the Neovim wrapper. + ''; + luaPackages = mkOption { type = listOf str; default = []; @@ -102,5 +117,18 @@ in { List of lua packages to install. ''; }; + + withPython3 = mkEnableOption '' + Python3 support in the Neovim wrapper. + ''; + + python3Packages = mkOption { + type = listOf str; + default = []; + example = literalExpression ''["pynvim"]''; + description = '' + List of python packages to install. + ''; + }; }; }