docs: add initial docs setup

This commit is contained in:
technofab 2025-09-02 11:00:38 +02:00
parent aa1abf945e
commit e7f7043012
No known key found for this signature in database
7 changed files with 101 additions and 5 deletions

2
docs/index.md Normal file
View file

@ -0,0 +1,2 @@
# Nix-GitLab-CI

3
docs/options.md Normal file
View file

@ -0,0 +1,3 @@
# Options
{% include 'options.md' %}

View file

@ -22,14 +22,14 @@
(simple "devShells")
(simple "pkgs")
(simple "tests")
# (simple "docs")
(simple "docs")
(simple "ci")
];
}
{
packages = ren.select self [
["repo" "tests"]
# ["repo" "docs"]
["repo" "docs"]
["repo" "ci" "packages"]
["packages" "pkgs"]
];

View file

@ -2,7 +2,7 @@
pkgs,
lib,
} @ args: let
inherit (lib) types isAttrs filterAttrs mapAttrs mkOption mkOptionType isType;
inherit (lib) types isAttrs filterAttrs mapAttrs mkOption mkOptionType isType literalExpression;
in rec {
prepend = key: arr: job: {
${key} = arr ++ (job.${key} or []);
@ -61,12 +61,17 @@ in rec {
_type = "unset";
};
isUnset = isType "unset";
unsetOr = types.either unsetType;
unsetOr = typ:
(types.either unsetType typ)
// {
description = typ.description;
};
mkUnsetOption = opts:
mkOption (opts
// {
type = unsetOr opts.type;
default = opts.default or unset;
defaultText = literalExpression "unset";
});
filterUnset = value:

View file

@ -1 +1,67 @@
{}
{inputs, ...}: let
inherit (inputs) pkgs cilib doclib;
optionsDoc = doclib.mkOptionDocs {
module = cilib.modules.nixCiSubmodule;
roots = [
{
url = "https://gitlab.com/TECHNOFAB/nix-gitlab-ci/-/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" = {
base = "${inputs.self}";
path = "${inputs.self}/docs";
material = {
enable = true;
colors = {
primary = "deep orange";
accent = "orange";
};
umami = {
enable = true;
src = "https://analytics.tf/umami";
siteId = "28f7c904-db22-4c2b-9ee4-ed42e14b6db9";
domains = ["nix-gitlab-ci.projects.tf"];
};
};
macros = {
enable = true;
includeDir = toString optionsDocs;
};
config = {
site_name = "Nix-GitLab-CI";
repo_name = "TECHNOFAB/nix-gitlab-ci";
repo_url = "https://gitlab.com/TECHNOFAB/nix-gitlab-ci";
theme = {
logo = "images/logo.png";
icon.repo = "simple/gitlab";
favicon = "images/favicon.png";
};
nav = [
{"Introduction" = "index.md";}
{"Options" = "options.md";}
];
markdown_extensions = [
{
"pymdownx.highlight".pygments_lang_class = true;
}
"pymdownx.inlinehilite"
"pymdownx.snippets"
"pymdownx.superfences"
"pymdownx.escapeall"
"fenced_code"
];
};
};
}).packages
// {
inherit optionsDocs;
}

18
nix/repo/flake.lock generated
View file

@ -17,6 +17,23 @@
"type": "gitlab"
}
},
"nixmkdocs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1755785622,
"narHash": "sha256-xBb9PCkszmrWSEqUiPC7oBJABm1thF572S5QHtloZ+M=",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"rev": "61da605a9bff12f66c4b743f43aea59ca200f533",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"type": "gitlab"
}
},
"nixtest-lib": {
"locked": {
"dir": "lib",
@ -37,6 +54,7 @@
"root": {
"inputs": {
"devshell-lib": "devshell-lib",
"nixmkdocs-lib": "nixmkdocs-lib",
"nixtest-lib": "nixtest-lib",
"soonix-lib": "soonix-lib",
"treefmt-nix": "treefmt-nix"

View file

@ -3,6 +3,7 @@
devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib";
nixtest-lib.url = "gitlab:TECHNOFAB/nixtest?dir=lib";
soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib";
nixmkdocs-lib.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
flake = false;
@ -14,6 +15,7 @@
devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;};
soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;};
ntlib = i.nixtest-lib.lib {inherit (i.parent) pkgs;};
doclib = i.nixmkdocs-lib.lib {inherit (i.parent) pkgs;};
cilib = import "${i.parent.self}/lib" {inherit (i.parent) pkgs;};
treefmt = import i.treefmt-nix;
};