Added manpages to the generated documentation

This commit is contained in:
hylodon 2026-03-01 19:28:05 +00:00
parent ba6377b375
commit 4472d74e96
5 changed files with 49 additions and 0 deletions

1
.gitignore vendored
View file

@ -4,5 +4,6 @@
!flake.nix !flake.nix
!flake.lock !flake.lock
!docs/**/*.nix !docs/**/*.nix
!docs/man/*.5
!lib/**/*.nix !lib/**/*.nix
!modules/**/*.nix !modules/**/*.nix

View file

@ -6,6 +6,8 @@
}: }:
let let
man = pkgs.callPackage ./man { inherit self; };
baseModule = _: { baseModule = _: {
# Hide documentation relating to _module.args, which isn't a part # Hide documentation relating to _module.args, which isn't a part
# of this flake # of this flake
@ -35,6 +37,8 @@ let
commonMark = docs.optionsCommonMark; commonMark = docs.optionsCommonMark;
json = docs.optionsJSON; json = docs.optionsJSON;
nix = docs.optionsNix; nix = docs.optionsNix;
man = man.build "modules" subcomponent docs.optionsJSON;
}; };
in in
{ {

30
docs/man/default.nix Normal file
View file

@ -0,0 +1,30 @@
{ pkgs, self, ... }:
{
build = type: subcomponent: json:
pkgs.runCommand "hylonix-${subcomponent}-manpage"
{
header = ./header.5;
footer = ./footer.5;
inherit type subcomponent json;
revision = self.lastModifiedDate;
nativeBuildInputs = [
pkgs.buildPackages.installShellFiles
pkgs.nixos-render-docs
];
allowedReferences = [ "out" ];
}
''
substitute "$header" ./header \
--subst-var subcomponent \
--subst-var type
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision "$revision" \
--header ./header \
--footer "$footer" \
"$json/share/doc/nixos/options.json" \
"hylonix-$subcomponent.5"
installManPage hylonix-*.5
'';
}

3
docs/man/footer.5 Normal file
View file

@ -0,0 +1,3 @@
.SH "AUTHORS"
.PP
hylodon

11
docs/man/header.5 Normal file
View file

@ -0,0 +1,11 @@
.TH "HYLONIX" "5" "01/01/1970" "hylonix"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" enable line breaks after slashes
.cflags 4 /
.SH "NAME"
\fIhylonix-@subcomponent@\fP \- @type@ from the hylonix flake
.SH "OPTIONS"
.PP