doc: Add Modules, modules.generic.meta-maintainers

This commit is contained in:
Robert Hensing
2025-08-17 20:42:40 +02:00
parent 1cafa1fd7e
commit e9f9e2dab1
5 changed files with 70 additions and 0 deletions

View File

@@ -15,12 +15,43 @@
markdown-code-runner,
roboto,
treefmt,
nixosOptionsDoc,
}:
stdenvNoCC.mkDerivation (
finalAttrs:
let
inherit (finalAttrs.finalPackage.optionsDoc) optionsJSON;
inherit (finalAttrs.finalPackage) epub lib-docs pythonInterpreterTable;
# Make anything from lib (the module system internals) invisible
hide-lib =
opt:
opt
// {
visible = if lib.all (decl: decl == "lib/modules.nix") opt.declarations then false else opt.visible;
};
toURL =
decl:
let
declStr = toString decl;
root = toString (../..);
subpath = lib.removePrefix "/" (lib.removePrefix root declStr);
in
if lib.hasPrefix root declStr then
{
url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}";
name = "nixpkgs/${subpath}";
}
else
decl;
mapURLs = opt: opt // { declarations = map toURL opt.declarations; };
docs.generic.meta-maintainers = nixosOptionsDoc {
inherit (lib.evalModules { modules = [ ../../modules/generic/meta-maintainers.nix ]; }) options;
transformOptions = opt: hide-lib (mapURLs opt);
};
in
{
name = "nixpkgs-manual";
@@ -49,6 +80,7 @@ stdenvNoCC.mkDerivation (
ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
ln -s ${treefmt.functionsDoc.markdown} ./packages/treefmt-functions.section.md
ln -s ${treefmt.optionsDoc.optionsJSON}/share/doc/nixos/options.json ./treefmt-options.json
ln -s ${docs.generic.meta-maintainers.optionsJSON}/share/doc/nixos/options.json ./options-modules-generic-meta-maintainers.json
'';
buildPhase = ''

View File

@@ -11,6 +11,7 @@ lib.md
stdenv.md
toolchains.md
build-helpers.md
modules/index.md
development.md
contributing.md
interoperability.md

View File

@@ -0,0 +1,16 @@
# Generic {#modules-generic}
Generic modules can be imported to extend configurations of any [class].
## `meta-maintainers.nix` {#modules-generic-meta-maintainers}
The options below become available when using `imports = [ (nixpkgs + "/modules/generic/meta-maintainers.nix") ];`.
```{=include=} options
id-prefix: opt-modules-generic-meta-maintainers-
list-id: configuration-variable-list
source: ../options-modules-generic-meta-maintainers.json
```
[class]: https://nixos.org/manual/nixpkgs/unstable/#module-system-lib-evalModules-param-class

12
doc/modules/index.md Normal file
View File

@@ -0,0 +1,12 @@
# Modules {#modules}
The Nixpkgs repository provides [Module System] modules for various purposes.
The following sections are organized by [module class].
```{=include=} chapters
generic.chapter.md
```
[Module System]: https://nixos.org/manual/nixpkgs/unstable/#module-system
[module class]: https://nixos.org/manual/nixpkgs/unstable/#module-system-lib-evalModules-param-class

View File

@@ -130,6 +130,15 @@
"minor-ghc-deprecation": [
"index.html#minor-ghc-deprecation"
],
"modules": [
"index.html#modules"
],
"modules-generic": [
"index.html#modules-generic"
],
"modules-generic-meta-maintainers": [
"index.html#modules-generic-meta-maintainers"
],
"neovim": [
"index.html#neovim"
],