docs: add docs and improve README

This commit is contained in:
technofab 2025-11-18 18:26:50 +01:00
parent 8cf73a70ef
commit c16bc97264
No known key found for this signature in database
10 changed files with 159 additions and 4 deletions

View file

@ -2,8 +2,10 @@
Templates for [Coder](https://coder.com), built with [Tofunix](https://tofunix.projects.tf).
Check [this Coder tutorial](https://coder.com/docs/tutorials/template-from-scratch#add-the-template-files-to-coder) for how to install the templates ("Dashboard" method recommended).
## Templates
- Nix Kubernetes
- Nix Kubernetes ([Download tar](https://gitlab.com/TECHNOFAB/coder-templates/-/jobs/artifacts/main/raw/templates/nix-kubernetes.tar?job=build:%20%5Bnix-kubernetes%5D))
> provisions a Coder workspace on Kubernetes, running a Nix-built image,
> which also contains Nix and supports Dotfiles management using home-manager.

1
docs/images/logo.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" fill="none"><g filter="url(#a)"><path stroke="url(#b)" stroke-width="5" d="m183.671 75.055-20.4 85.161-83.953 24.913-63.55-60.247L36.167 39.72l83.953-24.913 63.551 60.248Z"/></g><path fill="url(#c)" stroke="url(#d)" stroke-width="5" d="m183.671 75.055-20.4 85.161-83.953 24.913-63.55-60.247L36.167 39.72l83.953-24.913 63.551 60.248Z"/><g filter="url(#e)"><path fill="#FAFAFA" d="M114.372 125V75.98H156V125h-41.628Z"/><path fill="url(#f)" d="M114.372 125V75.98H156V125h-41.628Z"/><path fill="#FAFAFA" d="M104.46 95.588H88.602c0-5.882-4.956-10.784-8.92-10.784H68.778c-4.956 0-9.912 6.863-9.912 10.784v7.843c0 6.275 5.947 11.765 9.912 11.765H79.68c6.344 0 8.92-5.882 8.92-11.765h15.859c0 14.706-8.92 21.569-17.84 21.569H68.779C55.894 125 44 119.118 44 106.373V94.608C44 82.843 56.885 75 68.779 75h13.876c16.85 0 21.805 12.745 21.805 20.588Z"/><path fill="url(#g)" d="M104.46 95.588H88.602c0-5.882-4.956-10.784-8.92-10.784H68.778c-4.956 0-9.912 6.863-9.912 10.784v7.843c0 6.275 5.947 11.765 9.912 11.765H79.68c6.344 0 8.92-5.882 8.92-11.765h15.859c0 14.706-8.92 21.569-17.84 21.569H68.779C55.894 125 44 119.118 44 106.373V94.608C44 82.843 56.885 75 68.779 75h13.876c16.85 0 21.805 12.745 21.805 20.588Z"/></g><path fill="#FAFAFA" d="M114.372 125V75.98H156V125h-41.628Z"/><path fill="url(#h)" d="M114.372 125V75.98H156V125h-41.628Z"/><path fill="#FAFAFA" d="M104.46 95.588H88.602c0-5.882-4.956-10.784-8.92-10.784H68.778c-4.956 0-9.912 6.863-9.912 10.784v7.843c0 6.275 5.947 11.765 9.912 11.765H79.68c6.344 0 8.92-5.882 8.92-11.765h15.859c0 14.706-8.92 21.569-17.84 21.569H68.779C55.894 125 44 119.118 44 106.373V94.608C44 82.843 56.885 75 68.779 75h13.876c16.85 0 21.805 12.745 21.805 20.588Z"/><path fill="url(#i)" d="M104.46 95.588H88.602c0-5.882-4.956-10.784-8.92-10.784H68.778c-4.956 0-9.912 6.863-9.912 10.784v7.843c0 6.275 5.947 11.765 9.912 11.765H79.68c6.344 0 8.92-5.882 8.92-11.765h15.859c0 14.706-8.92 21.569-17.84 21.569H68.779C55.894 125 44 119.118 44 106.373V94.608C44 82.843 56.885 75 68.779 75h13.876c16.85 0 21.805 12.745 21.805 20.588Z"/><defs><linearGradient id="b" x1="13" x2="184.235" y1="99.969" y2="71.997" gradientUnits="userSpaceOnUse"><stop offset=".074" stop-color="#2F0"/><stop offset="1" stop-color="#0089FF"/></linearGradient><linearGradient id="c" x1="22.767" x2="186.365" y1="156.461" y2="64.715" gradientUnits="userSpaceOnUse"><stop stop-color="#1B1B1B"/><stop offset="1" stop-color="#1B1B1B"/></linearGradient><linearGradient id="d" x1="13" x2="184.235" y1="99.969" y2="71.997" gradientUnits="userSpaceOnUse"><stop offset=".074" stop-color="#2F0"/><stop offset="1" stop-color="#0089FF"/></linearGradient><linearGradient id="f" x1="63.552" x2="147.682" y1="108.636" y2="67.642" gradientUnits="userSpaceOnUse"><stop stop-color="#1EE400"/><stop offset="1" stop-color="#008CFF"/></linearGradient><linearGradient id="g" x1="63.552" x2="147.682" y1="108.636" y2="67.642" gradientUnits="userSpaceOnUse"><stop stop-color="#1EE400"/><stop offset="1" stop-color="#008CFF"/></linearGradient><linearGradient id="h" x1="63.552" x2="147.682" y1="108.636" y2="67.642" gradientUnits="userSpaceOnUse"><stop stop-color="#1EE400"/><stop offset="1" stop-color="#008CFF"/></linearGradient><linearGradient id="i" x1="63.552" x2="147.682" y1="108.636" y2="67.642" gradientUnits="userSpaceOnUse"><stop stop-color="#1EE400"/><stop offset="1" stop-color="#008CFF"/></linearGradient><filter id="a" width="193.439" height="195.937" x="3" y="2" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_1771_13699" stdDeviation="5"/></filter><filter id="e" width="116" height="54" x="42" y="73" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_1771_13699" stdDeviation="1"/></filter></defs></svg>

After

Width:  |  Height:  |  Size: 4 KiB

11
docs/index.md Normal file
View file

@ -0,0 +1,11 @@
# Coder Templates
Templates for [Coder](https://coder.com), built with [Tofunix](https://tofunix.projects.tf).
Check [this Coder tutorial](https://coder.com/docs/tutorials/template-from-scratch#add-the-template-files-to-coder) for how to install the templates ("Dashboard" method recommended).
## Templates
- [Nix Kubernetes](./parameters/nix-kubernetes.md) ([Download tar](https://gitlab.com/TECHNOFAB/coder-templates/-/jobs/artifacts/main/raw/templates/nix-kubernetes.tar?job=build:%20%5Bnix-kubernetes%5D))
> provisions a Coder workspace on Kubernetes, running a Nix-built image,
> which also contains Nix and supports Dotfiles management using home-manager.

15
docs/style.css Normal file
View file

@ -0,0 +1,15 @@
.md-header__button.md-logo {
margin: 0;
padding-top: .2rem;
padding-bottom: .2rem;
}
[dir="ltr"] .md-header__title {
margin-left: 0;
}
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
height: 2rem;
}

View file

@ -22,6 +22,7 @@
};
cellBlocks = with ren.blocks; [
(simple "devShells")
(simple "docs")
(simple "ci")
(simple "packages")
];
@ -29,6 +30,7 @@
{
packages = ren.select self [
["repo" "ci" "packages"]
["repo" "docs"]
["packages" "packages"]
];
};

View file

@ -8,11 +8,11 @@
"tofunix-lib": {
"locked": {
"dir": "lib",
"lastModified": 1763036122,
"narHash": "sha256-AFsuSeZ6MjJk5kxfL09rmhKh+AxUICfQhactWAMzVmo=",
"lastModified": 1763484138,
"narHash": "sha256-4WuyFH0OxRD1urqKQR62LioYRStit63s4sFo18CDJOA=",
"owner": "TECHNOFAB",
"repo": "tofunix",
"rev": "69bffa53c525d6128b6a23743149e37c72d3d5ba",
"rev": "cb0605cf53f61286407345d1ee32395e54ba42d1",
"type": "gitlab"
},
"original": {

View file

@ -39,6 +39,30 @@ in
];
artifacts.paths = ["dist/"];
};
"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 = "upload";
script = ["true"];
artifacts.paths = ["public"];
rules = [
{
"if" = "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH";
}
];
};
"upload" = {
stage = "upload";
nix.deps = [pkgs.buildah];

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

@ -0,0 +1,80 @@
{inputs, ...}: let
inherit (inputs) cells doclib pkgs;
inherit (pkgs.lib) concatMapStringsSep;
in
(doclib.mkDocs {
docs."default" = {
base = "${inputs.self}";
path = "${inputs.self}/docs";
material = {
enable = true;
colors = {
primary = "green";
accent = "light blue";
};
umami = {
enable = true;
src = "https://analytics.tf/umami";
siteId = "dc8d1f6c-50f6-4019-9b0d-9b924dedb111";
domains = ["coder-templates.projects.tf"];
};
};
dynamic-nav = {
enable = true;
files."Parameters" = map (template: {
${template} =
builtins.toFile "${template}.md"
# md
''
# ${template} Parameters
${
concatMapStringsSep "\n" (param: ''
## ${param.name}
${param.description}
Type: `${param.type}` <br>
Mutable: `${
if param.mutable
then "true"
else "false"
}` <br>
${
if param.default != ""
then "Default: `${param.default}` <br>"
else ""
}
'')
(builtins.attrValues cells.packages.packages."${template}-cli".module.config.data.coder_parameter)
}
'';
}) ["nix-kubernetes"];
};
config = {
site_name = "Coder Templates";
site_url = "https://coder-templates.projects.tf";
repo_name = "TECHNOFAB/coder-templates";
repo_url = "https://gitlab.com/TECHNOFAB/coder-templates";
extra_css = ["style.css"];
theme = {
logo = "images/logo.svg";
icon.repo = "simple/gitlab";
favicon = "images/logo.svg";
};
nav = [
{"Introduction" = "index.md";}
];
markdown_extensions = [
{
"pymdownx.highlight".pygments_lang_class = true;
}
"pymdownx.inlinehilite"
"pymdownx.snippets"
"pymdownx.superfences"
"pymdownx.escapeall"
"fenced_code"
];
};
};
}).packages

18
nix/repo/flake.lock generated
View file

@ -35,10 +35,28 @@
"type": "gitlab"
}
},
"nixmkdocs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1763481845,
"narHash": "sha256-Bp0+9rDmlPWMcnKqGx+BG4+o5KO8FuDAOvXRnXrm3Fo=",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"rev": "73d59093df94a894d25bc4bf71880b6f00faa62f",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"type": "gitlab"
}
},
"root": {
"inputs": {
"devshell-lib": "devshell-lib",
"nix-gitlab-ci-lib": "nix-gitlab-ci-lib",
"nixmkdocs-lib": "nixmkdocs-lib",
"soonix-lib": "soonix-lib",
"treefmt-nix": "treefmt-nix"
}

View file

@ -2,6 +2,7 @@
inputs = {
devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib";
soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib";
nixmkdocs-lib.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib";
nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.0.1?dir=lib";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
@ -13,6 +14,7 @@
// {
devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;};
soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;};
doclib = i.nixmkdocs-lib.lib {inherit (i.parent) pkgs;};
cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;};
treefmt = import i.treefmt-nix;
};