mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +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;
|
pkgs = pkgsDoc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inherit (helpers.modules) specialArgs;
|
||||||
|
|
||||||
nixvimPath = toString ./..;
|
nixvimPath = toString ./..;
|
||||||
|
|
||||||
gitHubDeclaration = user: repo: branch: subpath: {
|
gitHubDeclaration = user: repo: branch: subpath: {
|
||||||
|
@ -75,16 +77,7 @@ let
|
||||||
|
|
||||||
options-json =
|
options-json =
|
||||||
(pkgsDoc.nixosOptionsDoc {
|
(pkgsDoc.nixosOptionsDoc {
|
||||||
inherit
|
inherit (lib.evalModules { inherit modules specialArgs; }) options;
|
||||||
(lib.evalModules {
|
|
||||||
inherit modules;
|
|
||||||
specialArgs = {
|
|
||||||
inherit helpers;
|
|
||||||
defaultPkgs = pkgsDoc;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
options
|
|
||||||
;
|
|
||||||
inherit transformOptions;
|
inherit transformOptions;
|
||||||
warningsAreErrors = false;
|
warningsAreErrors = false;
|
||||||
}).optionsJSON;
|
}).optionsJSON;
|
||||||
|
@ -113,10 +106,10 @@ in
|
||||||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||||
docs = pkgsDoc.callPackage ./mdbook {
|
docs = pkgsDoc.callPackage ./mdbook {
|
||||||
inherit
|
inherit
|
||||||
helpers
|
|
||||||
modules
|
modules
|
||||||
hmOptions
|
hmOptions
|
||||||
transformOptions
|
transformOptions
|
||||||
|
specialArgs
|
||||||
;
|
;
|
||||||
# TODO: Find how to handle stable when 24.11 lands
|
# TODO: Find how to handle stable when 24.11 lands
|
||||||
search = mkSearch "/nixvim/search/";
|
search = mkSearch "/nixvim/search/";
|
||||||
|
|
|
@ -2,21 +2,15 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
modules,
|
modules,
|
||||||
helpers,
|
|
||||||
nixosOptionsDoc,
|
nixosOptionsDoc,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
hmOptions,
|
hmOptions,
|
||||||
search,
|
search,
|
||||||
|
specialArgs,
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
options = lib.evalModules {
|
options = lib.evalModules { inherit modules specialArgs; };
|
||||||
inherit modules;
|
|
||||||
specialArgs = {
|
|
||||||
inherit helpers;
|
|
||||||
defaultPkgs = pkgs;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
inherit (options.config.meta) nixvimInfo;
|
inherit (options.config.meta) nixvimInfo;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ let
|
||||||
extendedLib = call ./extend-lib.nix { inherit lib; };
|
extendedLib = call ./extend-lib.nix { inherit lib; };
|
||||||
keymaps = call ./keymap-helpers.nix { };
|
keymaps = call ./keymap-helpers.nix { };
|
||||||
lua = call ./to-lua.nix { };
|
lua = call ./to-lua.nix { };
|
||||||
|
modules = call ./modules.nix { };
|
||||||
neovim-plugin = call ./neovim-plugin.nix { };
|
neovim-plugin = call ./neovim-plugin.nix { };
|
||||||
nixvimTypes = call ./types.nix { };
|
nixvimTypes = call ./types.nix { };
|
||||||
options = call ./options.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,
|
config,
|
||||||
options,
|
options,
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
specialArgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -11,10 +11,7 @@ let
|
||||||
|
|
||||||
fileModuleType = types.submoduleWith {
|
fileModuleType = types.submoduleWith {
|
||||||
shorthandOnlyDefinesConfig = true;
|
shorthandOnlyDefinesConfig = true;
|
||||||
specialArgs = {
|
inherit specialArgs;
|
||||||
inherit helpers;
|
|
||||||
defaultPkgs = pkgs;
|
|
||||||
};
|
|
||||||
# Don't include the modules in the docs, as that'd be redundant
|
# Don't include the modules in the docs, as that'd be redundant
|
||||||
modules = lib.optionals (!config.isDocs) [
|
modules = lib.optionals (!config.isDocs) [
|
||||||
../../.
|
../../.
|
||||||
|
|
|
@ -23,12 +23,7 @@ in
|
||||||
default = { };
|
default = { };
|
||||||
type = types.submoduleWith {
|
type = types.submoduleWith {
|
||||||
shorthandOnlyDefinesConfig = true;
|
shorthandOnlyDefinesConfig = true;
|
||||||
specialArgs = {
|
specialArgs = config.lib.nixvim.modules.specialArgsWith { darwinConfig = config; };
|
||||||
darwinConfig = config;
|
|
||||||
defaultPkgs = pkgs;
|
|
||||||
helpers = config.lib.nixvim;
|
|
||||||
lib = config.lib.nixvim.extendedLib;
|
|
||||||
};
|
|
||||||
modules = [
|
modules = [
|
||||||
./modules/darwin.nix
|
./modules/darwin.nix
|
||||||
../modules/top-level
|
../modules/top-level
|
||||||
|
|
|
@ -22,12 +22,7 @@ in
|
||||||
default = { };
|
default = { };
|
||||||
type = types.submoduleWith {
|
type = types.submoduleWith {
|
||||||
shorthandOnlyDefinesConfig = true;
|
shorthandOnlyDefinesConfig = true;
|
||||||
specialArgs = {
|
specialArgs = config.lib.nixvim.modules.specialArgsWith { hmConfig = config; };
|
||||||
hmConfig = config;
|
|
||||||
defaultPkgs = pkgs;
|
|
||||||
helpers = config.lib.nixvim;
|
|
||||||
lib = config.lib.nixvim.extendedLib;
|
|
||||||
};
|
|
||||||
modules = [
|
modules = [
|
||||||
./modules/hm.nix
|
./modules/hm.nix
|
||||||
../modules/top-level
|
../modules/top-level
|
||||||
|
|
|
@ -23,12 +23,7 @@ in
|
||||||
default = { };
|
default = { };
|
||||||
type = types.submoduleWith {
|
type = types.submoduleWith {
|
||||||
shorthandOnlyDefinesConfig = true;
|
shorthandOnlyDefinesConfig = true;
|
||||||
specialArgs = {
|
specialArgs = config.lib.nixvim.modules.specialArgsWith { nixosConfig = config; };
|
||||||
nixosConfig = config;
|
|
||||||
defaultPkgs = pkgs;
|
|
||||||
helpers = config.lib.nixvim;
|
|
||||||
lib = config.lib.nixvim.extendedLib;
|
|
||||||
};
|
|
||||||
modules = [
|
modules = [
|
||||||
./modules/nixos.nix
|
./modules/nixos.nix
|
||||||
../modules/top-level
|
../modules/top-level
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
default_pkgs: self:
|
default_pkgs: self:
|
||||||
{
|
{
|
||||||
pkgs ? default_pkgs,
|
pkgs ? default_pkgs,
|
||||||
|
lib ? pkgs.lib,
|
||||||
extraSpecialArgs ? { },
|
extraSpecialArgs ? { },
|
||||||
_nixvimTests ? false,
|
_nixvimTests ? false,
|
||||||
module,
|
module,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (pkgs) lib;
|
|
||||||
|
|
||||||
helpers = import ../lib/helpers.nix { inherit pkgs lib _nixvimTests; };
|
helpers = import ../lib/helpers.nix { inherit pkgs lib _nixvimTests; };
|
||||||
|
|
||||||
|
inherit (helpers.modules) specialArgsWith;
|
||||||
|
|
||||||
handleAssertions =
|
handleAssertions =
|
||||||
config:
|
config:
|
||||||
let
|
let
|
||||||
|
@ -29,11 +30,7 @@ let
|
||||||
./modules/standalone.nix
|
./modules/standalone.nix
|
||||||
../modules/top-level
|
../modules/top-level
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = specialArgsWith extraSpecialArgs;
|
||||||
inherit helpers;
|
|
||||||
lib = helpers.extendedLib;
|
|
||||||
defaultPkgs = pkgs;
|
|
||||||
} // extraSpecialArgs;
|
|
||||||
};
|
};
|
||||||
config = handleAssertions evaledModule.config;
|
config = handleAssertions evaledModule.config;
|
||||||
in
|
in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue