Merge remote-tracking branch 'origin' into restructure

This commit is contained in:
raf 2024-02-19 10:50:42 +03:00
commit 4083a74281
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
4 changed files with 21 additions and 3 deletions

View file

@ -48,3 +48,7 @@ Release notes for release 0.6
[elijahimmer](https://github.com/elijahimmer) [elijahimmer](https://github.com/elijahimmer)
- Added rose-pine theme - Added rose-pine theme
[frothymarrow](https://github.com/frothymarrow)
- Added option `vim.luaPackages` to wrap neovim with extra Lua packages.

View file

@ -1,7 +1,7 @@
# Helpers for converting values to lua # Helpers for converting values to lua
{lib}: let {lib}: let
inherit (lib) mapAttrsToList filterAttrs concatStringsSep concatMapStringsSep stringToCharacters boolToString; inherit (lib) mapAttrsToList filterAttrs concatStringsSep concatMapStringsSep stringToCharacters boolToString;
inherit (builtins) hasAttr head; inherit (builtins) hasAttr head throw typeOf;
in rec { in rec {
# Convert a null value to lua's nil # Convert a null value to lua's nil
nullString = value: nullString = value:
@ -19,6 +19,8 @@ in rec {
then lib.boolToString exp # if bool, convert to string then lib.boolToString exp # if bool, convert to string
else if builtins.isInt exp else if builtins.isInt exp
then builtins.toString exp # if int, convert to string then builtins.toString exp # if int, convert to string
else if exp == null
then "nil"
else (builtins.toJSON exp); # otherwise jsonify the value and print as is else (builtins.toJSON exp); # otherwise jsonify the value and print as is
# convert list to a lua table # convert list to a lua table
@ -80,7 +82,7 @@ in rec {
then "${toString args}" then "${toString args}"
else if builtins.isInt args else if builtins.isInt args
then "${toString args}" then "${toString args}"
else if (args != null) else if (args == null)
then "nil" then "nil"
else ""; else throw "could not convert object of type `${typeOf args}` to lua object";
} }

View file

@ -153,6 +153,14 @@ in {
''; '';
}; };
luaPackages = mkOption {
type = types.listOf types.str;
default = [];
description = ''
List of lua packages to install.
'';
};
globals = mkOption { globals = mkOption {
default = {}; default = {};
description = "Set containing global variable values"; description = "Set containing global variable values";

View file

@ -23,6 +23,8 @@ inputs: {
vimOptions = module.config.vim; vimOptions = module.config.vim;
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
buildPlug = {pname, ...} @ args: buildPlug = {pname, ...} @ args:
assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter."; assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
buildVimPlugin (args buildVimPlugin (args
@ -59,6 +61,8 @@ inputs: {
inherit (vimOptions) viAlias; inherit (vimOptions) viAlias;
inherit (vimOptions) vimAlias; inherit (vimOptions) vimAlias;
inherit extraLuaPackages;
configure = { configure = {
customRC = vimOptions.builtConfigRC; customRC = vimOptions.builtConfigRC;