merge docs, add yagcd

This commit is contained in:
Peder Bergebakken Sundt 2023-02-26 03:53:55 +01:00
parent 181edd92e5
commit b1d987763c
8 changed files with 101 additions and 21 deletions

View File

@ -12,6 +12,8 @@
* [x] Split stuff into multiple files
* [x] Make a flake
* [x] merge hosted docs into a single subdomain
* [ ] pre-commit hook with 'nix eval'
* [ ] Setup some remote-development flow
* [ ] users/pbsds: Support multiple profiles, like headless, nixpkgs-dev, various desktops, hpc, pvv, etc
* [ ] nixos-generate-config instructions

View File

@ -32,6 +32,7 @@
"-L" # print build logs
];
};
# TODO: this doesn't work during 'nix eval' on a non-nixos machine
#assertions = [
# { assertion = builtins.pathExists "/etc/nixos/flake.nix"; message = "You have yet to test systems without a flake in /etc/nixos"; }
#];

View File

@ -47,8 +47,11 @@
#../../profiles/web/services/censordodge
#../../profiles/web/services/openspeedtest
../../profiles/web/docs
../../profiles/web/docs/pdoc
../../profiles/web/docs/python-docs
../../profiles/web/docs/yagcd
../../profiles/web/sites/linktree-pbsds
../../profiles/web/sites/refleksjon-no
../../profiles/web/sites/roroslyd-no

View File

@ -0,0 +1,48 @@
{ config, pkgs, lib, mkDomain, ... }:
{
options = with lib; {
#services.docs-to-host.enable = mkEnable "docs-to-host";
services.docs-to-host.docs = mkOption {
type = types.listOf (types.submodule {
options = {
subdir = mkOption {
type = types.str;
example = "pdoc";
description = lib.mdDoc "The path at which the documentation will be linked";
};
path = mkOption {
type = types.path;
example = lib.literalExpression "pkgs.fetchzip {...}";
description = lib.mdDoc "The static html documentation to host";
};
desc = mkOption {
type = types.str;
#description = "A short decription about the hosted documentation in markdown.";
description = "A short decription about the hosted documentation.";
};
};
});
default = [ ];
#description = lib.mdDoc ''TODO'';
};
};
config = let
cfg = config.services.docs-to-host;
mkRow = {subdir, path, desc}: ''<tr><td><a href="${subdir}/">${subdir}/</a><td>${desc}'';
mkEntry = {subdir, path, desc}: { name = subdir; path = path; };
in {
services.nginx.virtualHosts.${mkDomain "docs"} = {
forceSSL = true; # addSSL = true;
enableACME = true; #useACMEHost = acmeDomain;
root = pkgs.linkFarm "docs-html" ([{name = "index.html"; path = pkgs.writeText "docs-index.html" ''
<!DOCTYPE html>
<table>
<tr><th>URL<th>Desc
${lib.concatStringsSep "\n" ( builtins.map mkRow cfg.docs ) }
</table>
'';
}] ++ (builtins.map mkEntry cfg.docs));
};
};
}

View File

@ -252,11 +252,24 @@ let
in {
# lib.filter (x: lib.isDerivation x && (builtins.tryEval x.outPath).success) (lib.attrValues linuxPackages_latest))
# Pdoc
# Auto-generate API documentation for Python projects.
services.docs-to-host.docs = [
{
subdir = "pdoc-docs";
path = mkPdocs false;
desc = "Documentation for various python modules, generated with pdoc";
}
{
subdir = "pdoc3-docs";
path = mkPdocs true;
desc = "Documentation for various python modules, generated with pdoc";
}
];
/** /
services.nginx.virtualHosts.${mkDomain "pdoc"} = {
forceSSL = true; # addSSL = true;
enableACME = true; #useACMEHost = acmeDomain;
@ -267,5 +280,6 @@ in {
enableACME = true; #useACMEHost = acmeDomain;
root = mkPdocs true;
};
/**/
}

View File

@ -1,24 +1,12 @@
{ config, pkgs, lib, mkDomain, ... }:
{ config, pkgs, lib, ... }:
let
python-versions = (lib.attrNames pkgs.pythonDocs.html);
mkLinkFarmEntry = python-version: {
name = python-version;
python-versions = lib.attrNames (lib.filterAttrs (k: v: lib.isDerivation v) pkgs.pythonDocs.html);
mkDocsEntry = python-version: {
subdir = "${python-version}";
path = "${builtins.toString pkgs.pythonDocs.html.${python-version}}/share/doc/${python-version}/html";
desc = "Documentation for Python ${pkgs.${python-version}.version}";
};
in
{
services.nginx.virtualHosts.${mkDomain "python-docs"} = {
forceSSL = true; # addSSL = true;
enableACME = true; #useACMEHost = acmeDomain;
root = pkgs.linkFarm "python-docs" ([
{ name = "index.html"; path = pkgs.writeText "my-file" ''
<!DOCTYPE html>
<ul>
${lib.concatStringsSep "\n" (
builtins.map (name: ''<li><a href="${name}/">${name}/</a>'') python-versions
)}
</ul>
''; }
] ++ (builtins.map mkLinkFarmEntry python-versions));
};
services.docs-to-host.docs = builtins.map mkDocsEntry python-versions;
}

View File

@ -0,0 +1,23 @@
{ config, pkgs, lib, mkDomain, ... }:
let
yagcd = pkgs.fetchzip {
url = "http://hitmen.c02.at/files/yagcd/yagcd.tar.gz";
hash = "sha256-6/0oh7Xvbq1eAk2fCtKU+IXm0FbmgXIwAUjXuUKicus=";
stripRoot = false;
};
in
{
services.docs-to-host.docs = [{
desc = "Yet another Gamecube Documentation";
subdir = "yagcd";
path = "${yagcd}/yagcd";
}];
/** /
services.nginx.virtualHosts.${mkDomain "yagcd"} = {
forceSSL = true; # addSSL = true;
enableACME = true; #useACMEHost = acmeDomain;
root = yagcd;
};
/**/
}

View File

@ -10,6 +10,7 @@ let
www = "wwwwwwwwwwwwwww";
${config.networking.hostName} = www;
shlink = "Url shortener";
docs = "Various documentation";
};
in
{