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 # deprecated
persisthome = { persisthome = {
deprecated = true; deprecated = true;
sig = "Permission";
doc = "This was reworked to store data under `~/.local/share/jail.nix` and renamed to [persist-home](#persist-home).";
__functor = _: __functor = _:
name: name:
lib.warn "persisthome is deprecated, use persist-home instead. When doing so, rename ~/.local/share/jails/${name} to ${helpers.dataDirSubPath "home/${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 = { dbus-unsafe = {
deprecated = true; deprecated = true;
sig = "Permission";
doc = "This was renamed to [unsafe-dbus](#unsafe-dbus).";
__functor = _: __functor = _:
lib.warn "dbus-unsafe is deprecated, use unsafe-dbus instead" lib.warn "dbus-unsafe is deprecated, use unsafe-dbus instead"
unsafe-dbus; unsafe-dbus;

View file

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