use variables to define what module to generate documentation for
This commit is contained in:
parent
ccc0ff5a5c
commit
00cfdf243c
2 changed files with 41 additions and 83 deletions
100
docs/default.nix
100
docs/default.nix
|
|
@ -10,6 +10,11 @@
|
||||||
|
|
||||||
, release
|
, release
|
||||||
, allModules
|
, allModules
|
||||||
|
|
||||||
|
, version ? builtins.readFile ../VERSION
|
||||||
|
, substituteVersionIn
|
||||||
|
|
||||||
|
, modules
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
@ -121,96 +126,25 @@ in stdenv.mkDerivation {
|
||||||
${nmdsrc}/static/highlightjs/highlight.min.js \
|
${nmdsrc}/static/highlightjs/highlight.min.js \
|
||||||
${nmdsrc}/static/highlightjs/highlight.load.js
|
${nmdsrc}/static/highlightjs/highlight.load.js
|
||||||
|
|
||||||
substituteInPlace ./manual.md \
|
''
|
||||||
--replace \
|
+ lib.concatStringsSep "\n" (map (m: ''
|
||||||
'@VERSION@' \
|
substituteInPlace ${m} --replace '@VERSION@' ${version}
|
||||||
${builtins.readFile ../VERSION}
|
'') substituteVersionIn)
|
||||||
|
+ ''
|
||||||
substituteInPlace ./usage.md \
|
|
||||||
--replace \
|
|
||||||
'@VERSION@' \
|
|
||||||
${builtins.readFile ../VERSION}
|
|
||||||
|
|
||||||
substituteInPlace ./options.md \
|
substituteInPlace ./options.md \
|
||||||
--replace \
|
--replace \
|
||||||
'@OPTIONS_JSON@' \
|
'@OPTIONS_JSON@' \
|
||||||
${allOptionsDocs [
|
${allOptionsDocs [
|
||||||
(pkgs.path + "/nixos/modules/services/misc/forgejo.nix")
|
(pkgs.path + "/nixos/modules/services/misc/forgejo.nix")
|
||||||
]}/share/doc/nixos/options.json
|
]}/share/doc/nixos/options.json
|
||||||
|
''
|
||||||
substituteInPlace ./modules/blocks/ssl/docs/default.md \
|
+ lib.concatStringsSep "\n" (lib.mapAttrsToList (name: path: ''
|
||||||
--replace \
|
substituteInPlace ./modules/${name}/docs/default.md \
|
||||||
|
--replace-fail \
|
||||||
'@OPTIONS_JSON@' \
|
'@OPTIONS_JSON@' \
|
||||||
${individualModuleOptionsDocs [ ../modules/blocks/ssl.nix ]}/share/doc/nixos/options.json
|
${individualModuleOptionsDocs (if builtins.isList path then path else [ path ])}/share/doc/nixos/options.json
|
||||||
|
'') modules)
|
||||||
substituteInPlace ./modules/blocks/monitoring/docs/default.md \
|
+ ''
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/blocks/monitoring.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/blocks/postgresql/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/blocks/postgresql.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/blocks/restic/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/blocks/restic.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/blocks/sops/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/blocks/sops.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/services/arr/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/services/arr.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/services/home-assistant/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/services/home-assistant.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/services/nextcloud-server/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/services/nextcloud-server.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/services/vaultwarden/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/services/vaultwarden.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/services/forgejo/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [
|
|
||||||
../modules/services/forgejo.nix
|
|
||||||
(pkgs.path + "/nixos/modules/services/misc/forgejo.nix")
|
|
||||||
]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/contracts/backup/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/contracts/backup/dummyModule.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/contracts/databasebackup/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/contracts/databasebackup/dummyModule.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/contracts/secret/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/contracts/secret/dummyModule.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
substituteInPlace ./modules/contracts/ssl/docs/default.md \
|
|
||||||
--replace \
|
|
||||||
'@OPTIONS_JSON@' \
|
|
||||||
${individualModuleOptionsDocs [ ../modules/contracts/ssl/dummyModule.nix ]}/share/doc/nixos/options.json
|
|
||||||
|
|
||||||
find . -name "*.md" -print0 | \
|
find . -name "*.md" -print0 | \
|
||||||
while IFS= read -r -d ''' f; do
|
while IFS= read -r -d ''' f; do
|
||||||
substituteInPlace "''${f}" \
|
substituteInPlace "''${f}" \
|
||||||
|
|
|
||||||
24
flake.nix
24
flake.nix
|
|
@ -145,6 +145,30 @@
|
||||||
inherit nmdsrc;
|
inherit nmdsrc;
|
||||||
allModules = allModules ++ contractDummyModules;
|
allModules = allModules ++ contractDummyModules;
|
||||||
release = builtins.readFile ./VERSION;
|
release = builtins.readFile ./VERSION;
|
||||||
|
|
||||||
|
substituteVersionIn = [
|
||||||
|
"./manual.md"
|
||||||
|
"./usage.md"
|
||||||
|
];
|
||||||
|
modules = {
|
||||||
|
"blocks/ssl" = ./modules/blocks/ssl.nix;
|
||||||
|
"blocks/monitoring" = ./modules/blocks/monitoring.nix;
|
||||||
|
"blocks/postgresql" = ./modules/blocks/postgresql.nix;
|
||||||
|
"blocks/restic" = ./modules/blocks/restic.nix;
|
||||||
|
"blocks/sops" = ./modules/blocks/sops.nix;
|
||||||
|
"services/arr" = ./modules/services/arr.nix;
|
||||||
|
"services/forgejo" = [
|
||||||
|
./modules/services/forgejo.nix
|
||||||
|
(pkgs.path + "/nixos/modules/services/misc/forgejo.nix")
|
||||||
|
];
|
||||||
|
"services/home-assistant" = ./modules/services/home-assistant.nix;
|
||||||
|
"services/nextcloud-server" = ./modules/services/nextcloud-server.nix;
|
||||||
|
"services/vaultwarden" = ./modules/services/vaultwarden.nix;
|
||||||
|
"contracts/backup" = ./modules/contracts/backup/dummyModule.nix;
|
||||||
|
"contracts/databasebackup" = ./modules/contracts/databasebackup/dummyModule.nix;
|
||||||
|
"contracts/secret" = ./modules/contracts/secret/dummyModule.nix;
|
||||||
|
"contracts/ssl" = ./modules/contracts/ssl/dummyModule.nix;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Documentation redirect generation tool - scans HTML files for anchor mappings
|
# Documentation redirect generation tool - scans HTML files for anchor mappings
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue