mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
modules/files: don't include modules in the docs
This means we no longer need to spoof the module in the docs implementation. Instead, we supply the (optional) special arg `isDocs` to `evalModules`.
This commit is contained in:
parent
f5ba05ec82
commit
38d43a740f
3 changed files with 26 additions and 35 deletions
|
@ -56,35 +56,7 @@ let
|
||||||
) opt.declarations;
|
) opt.declarations;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixvmConfigType = lib.mkOptionType {
|
modules = [ ../modules/top-level ];
|
||||||
name = "nixvim-configuration";
|
|
||||||
description = "nixvim configuration options";
|
|
||||||
descriptionClass = "noun";
|
|
||||||
# Evaluation is irrelevant, only used for documentation.
|
|
||||||
};
|
|
||||||
|
|
||||||
# Construct our own top-level modules, because we want to stub the `files` option
|
|
||||||
# FIXME: add a way to handle this with specialArgs
|
|
||||||
topLevelModules = [
|
|
||||||
../modules
|
|
||||||
../modules/top-level/output.nix
|
|
||||||
# Fake module to avoid a duplicated documentation
|
|
||||||
(lib.setDefaultModuleLocation "${nixvimPath}/wrappers/modules/files.nix" {
|
|
||||||
options.files = lib.mkOption {
|
|
||||||
type = lib.types.attrsOf nixvmConfigType;
|
|
||||||
description = "Extra files to add to the runtimepath";
|
|
||||||
example = {
|
|
||||||
"ftplugin/nix.lua" = {
|
|
||||||
options = {
|
|
||||||
tabstop = 2;
|
|
||||||
shiftwidth = 2;
|
|
||||||
expandtab = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
hmOptions = builtins.removeAttrs (lib.evalModules {
|
hmOptions = builtins.removeAttrs (lib.evalModules {
|
||||||
modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ];
|
modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ];
|
||||||
|
@ -95,10 +67,11 @@ rec {
|
||||||
(pkgsDoc.nixosOptionsDoc {
|
(pkgsDoc.nixosOptionsDoc {
|
||||||
inherit
|
inherit
|
||||||
(lib.evalModules {
|
(lib.evalModules {
|
||||||
modules = topLevelModules;
|
inherit modules;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit helpers;
|
inherit helpers;
|
||||||
defaultPkgs = pkgsDoc;
|
defaultPkgs = pkgsDoc;
|
||||||
|
isDocs = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
options
|
options
|
||||||
|
@ -112,8 +85,11 @@ rec {
|
||||||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||||
// lib.optionalAttrs (!pkgsDoc.stdenv.isDarwin) {
|
// lib.optionalAttrs (!pkgsDoc.stdenv.isDarwin) {
|
||||||
docs = pkgsDoc.callPackage ./mdbook {
|
docs = pkgsDoc.callPackage ./mdbook {
|
||||||
inherit transformOptions;
|
inherit
|
||||||
modules = topLevelModules;
|
helpers
|
||||||
inherit helpers hmOptions;
|
modules
|
||||||
|
hmOptions
|
||||||
|
transformOptions
|
||||||
|
;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ let
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit helpers;
|
inherit helpers;
|
||||||
defaultPkgs = pkgs;
|
defaultPkgs = pkgs;
|
||||||
|
isDocs = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,28 +3,42 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
helpers,
|
||||||
|
specialArgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) types;
|
inherit (lib) types;
|
||||||
|
isDocs = specialArgs.isDocs or false;
|
||||||
|
|
||||||
fileModuleType = types.submoduleWith {
|
fileModuleType = types.submoduleWith {
|
||||||
shorthandOnlyDefinesConfig = true;
|
shorthandOnlyDefinesConfig = true;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit helpers;
|
inherit helpers;
|
||||||
defaultPkgs = pkgs;
|
defaultPkgs = pkgs;
|
||||||
};
|
};
|
||||||
modules = [
|
# Don't include the modules in the docs, as that'd be redundant
|
||||||
|
modules = lib.optionals (!isDocs) [
|
||||||
../../.
|
../../.
|
||||||
./submodule.nix
|
./submodule.nix
|
||||||
];
|
];
|
||||||
|
description = "Nixvim configuration";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
files = lib.mkOption {
|
files = lib.mkOption {
|
||||||
type = types.attrsOf fileModuleType;
|
type = types.attrsOf fileModuleType;
|
||||||
description = "Files to include in the Vim config.";
|
description = "Extra files to add to the runtimepath";
|
||||||
default = { };
|
default = { };
|
||||||
|
example = {
|
||||||
|
"ftplugin/nix.lua" = {
|
||||||
|
opts = {
|
||||||
|
tabstop = 2;
|
||||||
|
shiftwidth = 2;
|
||||||
|
expandtab = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
filesPlugin = lib.mkOption {
|
filesPlugin = lib.mkOption {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue