Include deprecated combinators in the docs

This commit is contained in:
Alex David 2025-08-07 17:23:14 -07:00
commit 5e86199537
2 changed files with 38 additions and 26 deletions

View file

@ -780,6 +780,8 @@ in rec {
# deprecated
persisthome = {
deprecated = true;
sig = "Permission";
doc = "This was reworked to store data under `~/.local/share/jail.nix` and renamed to [persist-home](#persist-home).";
__functor = _:
name:
lib.warn "persisthome is deprecated, use persist-home instead. When doing so, rename ~/.local/share/jails/${name} to ${helpers.dataDirSubPath "home/${name}"}"
@ -792,6 +794,8 @@ in rec {
dbus-unsafe = {
deprecated = true;
sig = "Permission";
doc = "This was renamed to [unsafe-dbus](#unsafe-dbus).";
__functor = _:
lib.warn "dbus-unsafe is deprecated, use unsafe-dbus instead"
unsafe-dbus;

View file

@ -21,28 +21,30 @@
attrPos = builtins.unsafeGetAttrPos "__functor" combinatorObj;
file = lib.removePrefix (toString ./..) attrPos.file;
in ''
## ${name}
### ${name}
**${name} :: ${combinatorObj.sig}**
[Source](${repo.urls.file file attrPos.line})
${combinatorObj.doc}
---
'';
combinatorDocs = lib.pipe
{
combinatorDocs = let
allCombinators = import ../lib/combinators.nix {
pkgs = throw "Docs must not depend on pkgs";
lib = throw "Docs must not depend on lib";
helpers = throw "Docs must not depend on helpers";
}
[
(import ../lib/combinators.nix)
(lib.filterAttrs (_: v: !(v ? deprecated && v.deprecated)))
};
formatSection = filter:
lib.pipe allCombinators [
(lib.filterAttrs (_: filter))
(lib.mapAttrsToList formatCombinatorDoc)
(lib.concatStringsSep "\n\n")
(docs: ''
(lib.concatStringsSep "\n\n---\n")
];
hr = ''<hr style="border: 2px solid #272525">'';
in ''
# Combinators
jail.nix combinators are the building blocks to create `Permission`s,
@ -52,11 +54,17 @@
funciton, as well as
[`basePermissions`](../advanced-configuration/#basepermissions).
---
${formatSection (v: !(v ? deprecated))}
${docs}
'')
];
${hr}
## Deprecated Combinators
The following combinators have been deprecated, and may be removed in the
future.
${formatSection (v: v ? deprecated)}
'';
mkdocsSettings = {
site_name = "jail-nix";