chore: add docs & CI

This commit is contained in:
technofab 2025-10-06 17:18:22 +02:00
parent 3363059b65
commit f8f5dbd535
No known key found for this signature in database
18 changed files with 407 additions and 26 deletions

34
nix/repo/ci.nix Normal file
View file

@ -0,0 +1,34 @@
{inputs, ...}: let
inherit (inputs) cilib;
in
cilib.mkCI {
pipelines."default" = {
stages = ["build" "deploy"];
jobs = {
"docs" = {
stage = "build";
script = [
# sh
''
nix build .#docs:default
mkdir -p public
cp -r result/. public/
''
];
artifacts.paths = ["public"];
};
"pages" = {
nix.enable = false;
image = "alpine:latest";
stage = "deploy";
script = ["true"];
artifacts.paths = ["public"];
rules = [
{
"if" = "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH";
}
];
};
};
};
}

View file

@ -1,16 +1,24 @@
{inputs, ...}: let
inherit (inputs) pkgs devshell treefmt;
{
inputs,
cell,
...
}: let
inherit (inputs) pkgs devshell treefmt soonix;
inherit (cell) ci;
in {
default = devshell.mkShell {
imports = [soonix.devshellModule];
packages = [
pkgs.nil
(treefmt.mkWrapper pkgs {
programs = {
alejandra.enable = true;
statix.enable = true;
deadnix.enable = true;
mdformat.enable = true;
};
})
];
soonix.hooks.ci = ci.soonix;
};
}

74
nix/repo/docs.nix Normal file
View file

@ -0,0 +1,74 @@
{inputs, ...}: let
inherit (inputs) pkgs utils doclib;
optionsDoc = doclib.mkOptionDocs {
inherit (utils) module;
roots = [
{
url = "https://gitlab.com/rensa-nix/utils/-/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 = "red";
accent = "red";
};
umami = {
enable = true;
src = "https://analytics.tf/umami";
siteId = "1e063417-931a-4fb7-81a1-fc506372ebcc";
domains = ["utils.rensa.projects.tf"];
};
};
macros = {
enable = true;
includeDir = toString optionsDocs;
};
config = {
site_name = "Utils";
site_url = "https://utils.rensa.projects.tf";
repo_name = "rensa-nix/utils";
repo_url = "https://gitlab.com/rensa-nix/utils";
extra_css = ["style.css"];
theme = {
logo = "images/logo.svg";
icon.repo = "simple/gitlab";
favicon = "images/logo.svg";
};
nav = [
{"Introduction" = "index.md";}
{"Utility Functions" = "utils.md";}
{"Options" = "options.md";}
];
markdown_extensions = [
{
"pymdownx.highlight".pygments_lang_class = true;
}
"pymdownx.inlinehilite"
"pymdownx.snippets"
"pymdownx.superfences"
"pymdownx.escapeall"
"fenced_code"
"attr_list"
{
"toc".permalink = "#";
}
];
};
};
}).packages
// {
inherit optionsDocs;
}

59
nix/repo/flake.lock generated
View file

@ -1,6 +1,6 @@
{
"nodes": {
"devshell-lib": {
"devshell": {
"locked": {
"dir": "lib",
"lastModified": 1758204313,
@ -17,12 +17,67 @@
"type": "gitlab"
}
},
"nix-gitlab-ci-lib": {
"locked": {
"dir": "lib",
"lastModified": 1758804624,
"narHash": "sha256-2AdxBYJKflgO7oZr1CfzyAxivDkGjvFmQpOuN6Yq128=",
"owner": "TECHNOFAB",
"repo": "nix-gitlab-ci",
"rev": "d88ada2c41ae05b08d7ec644a4d222e93fff78ae",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"ref": "3.0.0-alpha.3",
"repo": "nix-gitlab-ci",
"type": "gitlab"
}
},
"nixmkdocs": {
"locked": {
"dir": "lib",
"lastModified": 1757055638,
"narHash": "sha256-KHYSkEreFe4meXzSdEbknC/HwaQSNClQkc8vzHlAsMM=",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"rev": "7840a5febdbeaf2da90babf6c94b3d0929d2bf74",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"type": "gitlab"
}
},
"root": {
"inputs": {
"devshell-lib": "devshell-lib",
"devshell": "devshell",
"nix-gitlab-ci-lib": "nix-gitlab-ci-lib",
"nixmkdocs": "nixmkdocs",
"soonix-lib": "soonix-lib",
"treefmt-nix": "treefmt-nix"
}
},
"soonix-lib": {
"locked": {
"dir": "lib",
"lastModified": 1758615778,
"narHash": "sha256-tggru+siXlLcLUjHtMojkJJWTS/8I3gm8nhnlz+qrTo=",
"owner": "TECHNOFAB",
"repo": "soonix",
"rev": "e04b71c07413251dcb52036b4a51c6c7c0dca2ad",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"repo": "soonix",
"type": "gitlab"
}
},
"treefmt-nix": {
"flake": false,
"locked": {

View file

@ -1,6 +1,9 @@
{
inputs = {
devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib";
nixmkdocs.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib";
devshell.url = "gitlab:rensa-nix/devshell?dir=lib";
soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib";
nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.0.0-alpha.3?dir=lib";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
flake = false;
@ -9,7 +12,11 @@
outputs = i:
i
// {
devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;};
doclib = i.nixmkdocs.lib {inherit (i.parent) pkgs;};
devshell = i.devshell.lib {inherit (i.parent) pkgs;};
soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;};
cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;};
utils = import "${i.parent.self}/lib" {inherit (i.parent.pkgs) lib;};
treefmt = import i.treefmt-nix;
};
}