plasma-manager/docs/default.nix
magnouvean 110d50c34f
Some checks are pending
GitHub Pages / publish (ubuntu-latest) (push) Waiting to run
Add plasma-manager documentation generation (#278)
2024-07-30 19:10:38 +02:00

46 lines
1.3 KiB
Nix

{ pkgs, lib, ... }:
let
dontCheckModules = { _module.check = false; };
modules = [ ../modules dontCheckModules ];
githubDeclaration = user: repo: branch: subpath: {
url = "https://github.com/${user}/${repo}/blob/${branch}/${subpath}";
name = "<${repo}/${subpath}>";
};
pmPath = toString ./..;
transformOptions =
opt: opt // {
declarations = (map
(decl:
if (lib.hasPrefix pmPath (toString decl)) then (githubDeclaration "nix-community" "plasma-manager" "trunk" (lib.removePrefix "/" (lib.removePrefix pmPath (toString decl)))) else decl)
opt.declarations);
};
buildOptionsDocs = (args@{ modules, ... }:
let
opts = (lib.evalModules {
inherit modules;
class = "homeManager";
}).options;
options = builtins.removeAttrs opts [ "_module" ];
in
pkgs.buildPackages.nixosOptionsDoc {
inherit options;
inherit transformOptions;
warningsAreErrors = false;
});
pmOptionsDoc = buildOptionsDocs {
inherit modules;
};
plasma-manager-options = pkgs.callPackage ./plasma-manager-options.nix {
nixos-render-docs = pkgs.nixos-render-docs;
plasma-manager-options = pmOptionsDoc.optionsJSON;
revision = "latest";
};
in
{
html = plasma-manager-options;
}