mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
lib/modules: init with specialArgs
helpers
This commit is contained in:
parent
491ca5cf51
commit
27c4c9c210
9 changed files with 35 additions and 49 deletions
|
@ -40,6 +40,8 @@ let
|
|||
pkgs = pkgsDoc;
|
||||
};
|
||||
|
||||
inherit (helpers.modules) specialArgs;
|
||||
|
||||
nixvimPath = toString ./..;
|
||||
|
||||
gitHubDeclaration = user: repo: branch: subpath: {
|
||||
|
@ -75,16 +77,7 @@ let
|
|||
|
||||
options-json =
|
||||
(pkgsDoc.nixosOptionsDoc {
|
||||
inherit
|
||||
(lib.evalModules {
|
||||
inherit modules;
|
||||
specialArgs = {
|
||||
inherit helpers;
|
||||
defaultPkgs = pkgsDoc;
|
||||
};
|
||||
})
|
||||
options
|
||||
;
|
||||
inherit (lib.evalModules { inherit modules specialArgs; }) options;
|
||||
inherit transformOptions;
|
||||
warningsAreErrors = false;
|
||||
}).optionsJSON;
|
||||
|
@ -113,10 +106,10 @@ in
|
|||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||
docs = pkgsDoc.callPackage ./mdbook {
|
||||
inherit
|
||||
helpers
|
||||
modules
|
||||
hmOptions
|
||||
transformOptions
|
||||
specialArgs
|
||||
;
|
||||
# TODO: Find how to handle stable when 24.11 lands
|
||||
search = mkSearch "/nixvim/search/";
|
||||
|
|
|
@ -2,21 +2,15 @@
|
|||
pkgs,
|
||||
lib,
|
||||
modules,
|
||||
helpers,
|
||||
nixosOptionsDoc,
|
||||
transformOptions,
|
||||
hmOptions,
|
||||
search,
|
||||
specialArgs,
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
options = lib.evalModules {
|
||||
inherit modules;
|
||||
specialArgs = {
|
||||
inherit helpers;
|
||||
defaultPkgs = pkgs;
|
||||
};
|
||||
};
|
||||
options = lib.evalModules { inherit modules specialArgs; };
|
||||
|
||||
inherit (options.config.meta) nixvimInfo;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ let
|
|||
extendedLib = call ./extend-lib.nix { inherit lib; };
|
||||
keymaps = call ./keymap-helpers.nix { };
|
||||
lua = call ./to-lua.nix { };
|
||||
modules = call ./modules.nix { };
|
||||
neovim-plugin = call ./neovim-plugin.nix { };
|
||||
nixvimTypes = call ./types.nix { };
|
||||
options = call ./options.nix { };
|
||||
|
|
19
lib/modules.nix
Normal file
19
lib/modules.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
rec {
|
||||
# Minimal specialArgs required to evaluate nixvim modules
|
||||
specialArgs = specialArgsWith { };
|
||||
|
||||
# Build specialArgs for evaluating nixvim modules
|
||||
specialArgsWith =
|
||||
extraSpecialArgs:
|
||||
{
|
||||
# TODO: deprecate `helpers`
|
||||
inherit lib helpers;
|
||||
defaultPkgs = pkgs;
|
||||
}
|
||||
// extraSpecialArgs;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
config,
|
||||
options,
|
||||
lib,
|
||||
helpers,
|
||||
specialArgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
@ -11,10 +11,7 @@ let
|
|||
|
||||
fileModuleType = types.submoduleWith {
|
||||
shorthandOnlyDefinesConfig = true;
|
||||
specialArgs = {
|
||||
inherit helpers;
|
||||
defaultPkgs = pkgs;
|
||||
};
|
||||
inherit specialArgs;
|
||||
# Don't include the modules in the docs, as that'd be redundant
|
||||
modules = lib.optionals (!config.isDocs) [
|
||||
../../.
|
||||
|
|
|
@ -23,12 +23,7 @@ in
|
|||
default = { };
|
||||
type = types.submoduleWith {
|
||||
shorthandOnlyDefinesConfig = true;
|
||||
specialArgs = {
|
||||
darwinConfig = config;
|
||||
defaultPkgs = pkgs;
|
||||
helpers = config.lib.nixvim;
|
||||
lib = config.lib.nixvim.extendedLib;
|
||||
};
|
||||
specialArgs = config.lib.nixvim.modules.specialArgsWith { darwinConfig = config; };
|
||||
modules = [
|
||||
./modules/darwin.nix
|
||||
../modules/top-level
|
||||
|
|
|
@ -22,12 +22,7 @@ in
|
|||
default = { };
|
||||
type = types.submoduleWith {
|
||||
shorthandOnlyDefinesConfig = true;
|
||||
specialArgs = {
|
||||
hmConfig = config;
|
||||
defaultPkgs = pkgs;
|
||||
helpers = config.lib.nixvim;
|
||||
lib = config.lib.nixvim.extendedLib;
|
||||
};
|
||||
specialArgs = config.lib.nixvim.modules.specialArgsWith { hmConfig = config; };
|
||||
modules = [
|
||||
./modules/hm.nix
|
||||
../modules/top-level
|
||||
|
|
|
@ -23,12 +23,7 @@ in
|
|||
default = { };
|
||||
type = types.submoduleWith {
|
||||
shorthandOnlyDefinesConfig = true;
|
||||
specialArgs = {
|
||||
nixosConfig = config;
|
||||
defaultPkgs = pkgs;
|
||||
helpers = config.lib.nixvim;
|
||||
lib = config.lib.nixvim.extendedLib;
|
||||
};
|
||||
specialArgs = config.lib.nixvim.modules.specialArgsWith { nixosConfig = config; };
|
||||
modules = [
|
||||
./modules/nixos.nix
|
||||
../modules/top-level
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
default_pkgs: self:
|
||||
{
|
||||
pkgs ? default_pkgs,
|
||||
lib ? pkgs.lib,
|
||||
extraSpecialArgs ? { },
|
||||
_nixvimTests ? false,
|
||||
module,
|
||||
}:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
helpers = import ../lib/helpers.nix { inherit pkgs lib _nixvimTests; };
|
||||
|
||||
inherit (helpers.modules) specialArgsWith;
|
||||
|
||||
handleAssertions =
|
||||
config:
|
||||
let
|
||||
|
@ -29,11 +30,7 @@ let
|
|||
./modules/standalone.nix
|
||||
../modules/top-level
|
||||
];
|
||||
specialArgs = {
|
||||
inherit helpers;
|
||||
lib = helpers.extendedLib;
|
||||
defaultPkgs = pkgs;
|
||||
} // extraSpecialArgs;
|
||||
specialArgs = specialArgsWith extraSpecialArgs;
|
||||
};
|
||||
config = handleAssertions evaledModule.config;
|
||||
in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue