From 71303ad324131c2b47695c813040dfa7d3a36fcb Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 30 Apr 2024 00:48:10 +0300 Subject: [PATCH] move nix2lua to the extended lib --- default.nix | 2 +- lib/default.nix | 2 ++ modules/build/neovim.nix | 4 ++-- modules/plugin.nix | 6 +++--- modules/plugins/navigation/telescope.nix | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/default.nix b/default.nix index f7df7d9..92ddec6 100644 --- a/default.nix +++ b/default.nix @@ -19,7 +19,7 @@ let rawModule = evalModules { modules = [ config ] ++ allModules; - specialArgs = { inherit pkgs lib nix2lua; }; + specialArgs = { inherit pkgs lib; }; }; failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions); diff --git a/lib/default.nix b/lib/default.nix index 1864d13..8453fd2 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -4,5 +4,7 @@ let types = import ./types.nix { inherit lib nix2lua; }; in lib // { + inherit nix2lua; + types = lib.types // types; } diff --git a/modules/build/neovim.nix b/modules/build/neovim.nix index 7be2a5e..2c63d9b 100644 --- a/modules/build/neovim.nix +++ b/modules/build/neovim.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, nix2lua, ... }: +{ config, lib, pkgs, ... }: let inherit (builtins) filter attrValues; @@ -31,7 +31,7 @@ in }; config.build.neovim = { - luaConfig = with nix2lua; toLua (spaceBetween (lib.flatten [ + luaConfig = with lib.nix2lua; toLua (spaceBetween (lib.flatten [ # Global Opts (lib.flip lib.mapAttrsToList config.vim.g (k: set "vim.g.${k}")) # Opts diff --git a/modules/plugin.nix b/modules/plugin.nix index e5fd4a2..79ba42c 100644 --- a/modules/plugin.nix +++ b/modules/plugin.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, nix2lua, ... }: +{ lib, pkgs, ... }: let @@ -56,7 +56,7 @@ let name = lib.mkDefault 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))) config.beforeSetup (lib.optional (config.setupSettings != null) @@ -66,7 +66,7 @@ let config.extra ]); - luaConfig = with nix2lua; toLua (spaceBetween config.genConfig); + luaConfig = with lib.nix2lua; toLua (spaceBetween config.genConfig); }; }); diff --git a/modules/plugins/navigation/telescope.nix b/modules/plugins/navigation/telescope.nix index c239844..e87971a 100644 --- a/modules/plugins/navigation/telescope.nix +++ b/modules/plugins/navigation/telescope.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, nix2lua, ... }: +{ config, lib, pkgs, ... }: let inherit (builtins) match isFunction attrValues; @@ -38,7 +38,7 @@ let config = { name = lib.mkDefault name; - loadExtension = with nix2lua; lib.mkDefault (pipe1 + loadExtension = with lib.nix2lua; lib.mkDefault (pipe1 (var config.plugin.telescope-nvim.varName) (call "load_extension" sub.config.name) );