diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..07a2ade --- /dev/null +++ b/docs/index.md @@ -0,0 +1,2 @@ +# Nix-GitLab-CI + diff --git a/docs/options.md b/docs/options.md new file mode 100644 index 0000000..4ca74a4 --- /dev/null +++ b/docs/options.md @@ -0,0 +1,3 @@ +# Options + +{% include 'options.md' %} diff --git a/flake.nix b/flake.nix index b507b22..769a6b9 100644 --- a/flake.nix +++ b/flake.nix @@ -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"] ]; diff --git a/lib/impl/helpers.nix b/lib/impl/helpers.nix index 38dc030..147788c 100644 --- a/lib/impl/helpers.nix +++ b/lib/impl/helpers.nix @@ -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: diff --git a/nix/repo/docs.nix b/nix/repo/docs.nix index 0967ef4..d82a071 100644 --- a/nix/repo/docs.nix +++ b/nix/repo/docs.nix @@ -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; + } diff --git a/nix/repo/flake.lock b/nix/repo/flake.lock index 5483152..0463608 100644 --- a/nix/repo/flake.lock +++ b/nix/repo/flake.lock @@ -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" diff --git a/nix/repo/flake.nix b/nix/repo/flake.nix index 35542de..149ae74 100644 --- a/nix/repo/flake.nix +++ b/nix/repo/flake.nix @@ -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; };