feat: add support for importing nixlets into each other

This commit is contained in:
technofab 2026-02-09 17:37:02 +01:00
parent c44a5fc995
commit 2c21317f45
Signed by: technofab
SSH key fingerprint: SHA256:bV4h88OqS/AxjbPn66uUdvK9JsgIW4tv3vwJQ8tpMqQ
6 changed files with 345 additions and 151 deletions

View file

@ -3,8 +3,22 @@
cell,
...
}: let
inherit (inputs) doclib;
inherit (inputs) pkgs doclib nixlet-lib;
inherit (cell) nixlets;
optionsDoc = doclib.mkOptionDocs {
module = nixlet-lib.nixletModule;
roots = [
{
url = "https://gitlab.com/TECHNOFAB/nixlets/-/blob/main/lib";
path = "${inputs.self}/lib";
}
];
};
optionsDocs = pkgs.runCommand "options-docs" {} ''
mkdir -p $out
ln -s ${optionsDoc} $out/options.md
'';
in
(doclib.mkDocs {
docs."default" = {
@ -23,9 +37,13 @@ in
domains = ["nixlets.projects.tf"];
};
};
macros = {
enable = true;
includeDir = toString optionsDocs;
};
dynamic-nav = {
enable = true;
files."Nixlets Values" = builtins.map (val: {${val.name} = val.mkDocs {};}) (builtins.attrValues nixlets);
files."Nixlets Values" = builtins.map (val: {${val.name} = val.mkDocs {fullValues = true;};}) (builtins.attrValues nixlets);
};
config = {
site_name = "Nixlets";
@ -45,6 +63,7 @@ in
{"Usage" = "usage.md";}
{"Generating Docs" = "generating_docs.md";}
{"Secrets" = "secrets.md";}
{"Options" = "options.md";}
];
markdown_extensions = [
{

6
nix/repo/flake.lock generated
View file

@ -38,11 +38,11 @@
"nixmkdocs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1766062227,
"narHash": "sha256-jhr5CUi9eDeMIAJn7ayXP8Wr+Y2loV5EhdDIKDkRIdw=",
"lastModified": 1767549915,
"narHash": "sha256-by3r2qddlyzylup5fzSaDwtoy3eFHNKb65IuIq6bsAs=",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"rev": "cb0bb5dc3382e8ba5d81324a2f1fd94ccd5a5df4",
"rev": "f3b2f4b19178e97c5580367be0f97e61a085db6d",
"type": "gitlab"
},
"original": {