move nix2lua to the extended lib

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-30 00:48:10 +03:00
parent d82800af41
commit 71303ad324
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
5 changed files with 10 additions and 8 deletions

View file

@ -19,7 +19,7 @@ let
rawModule = evalModules { rawModule = evalModules {
modules = [ config ] ++ allModules; modules = [ config ] ++ allModules;
specialArgs = { inherit pkgs lib nix2lua; }; specialArgs = { inherit pkgs lib; };
}; };
failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions); failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);

View file

@ -4,5 +4,7 @@ let
types = import ./types.nix { inherit lib nix2lua; }; types = import ./types.nix { inherit lib nix2lua; };
in in
lib // { lib // {
inherit nix2lua;
types = lib.types // types; types = lib.types // types;
} }

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, nix2lua, ... }: { config, lib, pkgs, ... }:
let let
inherit (builtins) filter attrValues; inherit (builtins) filter attrValues;
@ -31,7 +31,7 @@ in
}; };
config.build.neovim = { config.build.neovim = {
luaConfig = with nix2lua; toLua (spaceBetween (lib.flatten [ luaConfig = with lib.nix2lua; toLua (spaceBetween (lib.flatten [
# Global Opts # Global Opts
(lib.flip lib.mapAttrsToList config.vim.g (k: set "vim.g.${k}")) (lib.flip lib.mapAttrsToList config.vim.g (k: set "vim.g.${k}"))
# Opts # Opts

View file

@ -1,4 +1,4 @@
{ lib, pkgs, nix2lua, ... }: { lib, pkgs, ... }:
let let
@ -56,7 +56,7 @@ let
name = lib.mkDefault name; name = lib.mkDefault name;
varName = lib.mkDefault (builtins.replaceStrings [ "-" "/" ] [ "_" "_" ] config.name); varName = lib.mkDefault (builtins.replaceStrings [ "-" "/" ] [ "_" "_" ] config.name);
genConfig = with nix2lua; lib.mkIf (!config.isDependency) (lib.flatten [ genConfig = with lib.nix2lua; lib.mkIf (!config.isDependency) (lib.flatten [
(local (set config.varName (require config.name))) (local (set config.varName (require config.name)))
config.beforeSetup config.beforeSetup
(lib.optional (config.setupSettings != null) (lib.optional (config.setupSettings != null)
@ -66,7 +66,7 @@ let
config.extra config.extra
]); ]);
luaConfig = with nix2lua; toLua (spaceBetween config.genConfig); luaConfig = with lib.nix2lua; toLua (spaceBetween config.genConfig);
}; };
}); });

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, nix2lua, ... }: { config, lib, pkgs, ... }:
let let
inherit (builtins) match isFunction attrValues; inherit (builtins) match isFunction attrValues;
@ -38,7 +38,7 @@ let
config = { config = {
name = lib.mkDefault name; name = lib.mkDefault name;
loadExtension = with nix2lua; lib.mkDefault (pipe1 loadExtension = with lib.nix2lua; lib.mkDefault (pipe1
(var config.plugin.telescope-nvim.varName) (var config.plugin.telescope-nvim.varName)
(call "load_extension" sub.config.name) (call "load_extension" sub.config.name)
); );