2023-11-09 20:29:36 +01:00
|
|
|
{ eval, lib, pkgs }:
|
2023-08-06 23:25:37 +02:00
|
|
|
let
|
|
|
|
inherit (lib) types;
|
|
|
|
conf = eval.config;
|
2023-11-09 20:29:36 +01:00
|
|
|
rootDir = builtins.toPath ./..;
|
|
|
|
stripAnyPrefixes = lib.flip (lib.fold lib.removePrefix)
|
|
|
|
["${rootDir}/"];
|
2023-08-06 23:25:37 +02:00
|
|
|
optToDoc = name: opt : {
|
|
|
|
inherit name;
|
|
|
|
description = opt.description or null;
|
|
|
|
default = opt.default or null;
|
|
|
|
visible =
|
|
|
|
if (opt ? visible && opt.visible == "shallow")
|
|
|
|
then true
|
|
|
|
else opt.visible or true;
|
|
|
|
readOnly = opt.readOnly or false;
|
|
|
|
type = opt.type.description or "unspecified";
|
|
|
|
};
|
|
|
|
spliceServiceDefn = item :
|
|
|
|
if item.type == "parametrisable s6-rc service definition"
|
|
|
|
then
|
|
|
|
let sd = lib.attrByPath item.loc ["not found"] conf;
|
|
|
|
in item // {
|
2023-11-09 20:29:36 +01:00
|
|
|
declarations = map stripAnyPrefixes item.declarations;
|
2023-08-06 23:25:37 +02:00
|
|
|
parameters =
|
|
|
|
let x = lib.mapAttrsToList optToDoc sd.parameters; in x;
|
|
|
|
}
|
|
|
|
else
|
2023-11-09 20:29:36 +01:00
|
|
|
item // { declarations = map stripAnyPrefixes item.declarations; };
|
|
|
|
in
|
|
|
|
builtins.map spliceServiceDefn
|
|
|
|
(pkgs.lib.optionAttrSetToDocList eval.options)
|