feat(son): add DGN infra doc

This commit is contained in:
catvayor 2024-12-11 23:27:47 +01:00
parent b56afb2ca7
commit a4a9ae9e12
Signed by: lbailly
GPG key ID: CE3E645251AC63F3
2 changed files with 76 additions and 17 deletions

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
pkgs, pkgs,
modulesPath,
... ...
}: }:
{ {
@ -78,26 +79,67 @@
}; };
extranix = { extranix = {
enable = true; enable = true;
modules."netconf" = let modules = {
"netconf" =
let
netconf = pkgs.fetchgit { netconf = pkgs.fetchgit {
url = "https://git.dgnum.eu/DGNum/Netconf-Module.git"; url = "https://git.dgnum.eu/DGNum/Netconf-Module.git";
rev = "8f58ee21fe9c0ad22e3f16e58c3837c1c97eb5e8"; rev = "8f58ee21fe9c0ad22e3f16e58c3837c1c97eb5e8";
outputHash = "sha256-OXKSFEOjeeRFVbVodJSkhuT+r7+p6QPUzjbw2vs6Xao="; outputHash = "sha256-OXKSFEOjeeRFVbVodJSkhuT+r7+p6QPUzjbw2vs6Xao=";
name = "netconf"; name = "netconf";
}; };
in { in
paths = [ "${netconf.outPath}/junos" "${netconf.outPath}/dgn-module.nix" ]; {
paths = [
"${netconf.outPath}/junos"
"${netconf.outPath}/dgn-module.nix"
];
base = netconf.outPath; base = netconf.outPath;
url = "https://git.dgnum.eu/DGNum/Netconf-Module/src/branch/master/"; url = "https://git.dgnum.eu/DGNum/Netconf-Module/src/branch/master/";
}; };
"infra DGNum" =
let
infra = pkgs.fetchgit {
url = "https://git.dgnum.eu/DGNum/infrastructure.git";
rev = "417ce615079ca26e1251e7f0b6b24c36b293a17d";
outputHash = "sha256-LhjQoVZqYARpUxuuWhcNY7HLE64H8PIIBZ0QwlmGD2I=";
name = "DGN-infra";
};
in
{
paths = [
"${infra}/modules/generic"
"${infra}/modules/nixos"
];
ignored-modules = import "${modulesPath}/module-list.nix";
specialArgs = {
lib = lib // {
extra = import "${infra}/lib/nix-lib";
};
inherit pkgs modulesPath;
name = "<nodeName>";
nodeMeta = {
nix-modules = [ ];
admins = [ ];
adminGroups = [ ];
};
meta = {
organization.groups.root = [ ];
};
sources = (import "${infra}/hive.nix").meta.specialArgs.sources;
};
base = infra.outPath;
url = "https://git.dgnum.eu/DGNum/infrastructure/src/branch/main/";
};
};
static-data = ./static-data; static-data = ./static-data;
host = "son.katvayor.net"; host = "son.katvayor.net";
settings = { settings = {
baseUrl = "https://dgnum.eu/"; baseUrl = "https://dgnum.eu/";
title = "DGNum netconf module documentation"; title = "DGNum module documentation";
languageCode = "en-us"; languageCode = "en-us";
params = { params = {
release_current_stable = "netconf"; release_current_stable = "infra-DGNum";
logo = "images/dgnum.png"; logo = "images/dgnum.png";
footer_credits_line = '' footer_credits_line = ''
Powered by catvayor | Powered by catvayor |

View file

@ -11,12 +11,12 @@ let
mkIf mkIf
types types
importJSON importJSON
filterAttrs
mapAttrs' mapAttrs'
mapAttrsToList mapAttrsToList
removePrefix removePrefix
pathIsDirectory pathIsDirectory
hasSuffix hasSuffix
attrNames
; ;
inherit (lib.strings) inherit (lib.strings)
sanitizeDerivationName sanitizeDerivationName
@ -28,10 +28,19 @@ let
module-eval = module-eval =
module: module:
let let
eval = lib.evalModules { modules = module.paths; }; ignored-eval = lib.evalModules {
modules = module.ignored-modules;
inherit (module) specialArgs;
};
ignored-opts-doc = pkgs.nixosOptionsDoc { inherit (ignored-eval) options; };
ignored-opts = importJSON "${ignored-opts-doc.optionsJSON}/share/doc/nixos/options.json";
eval = lib.evalModules {
modules = module.paths ++ module.ignored-modules;
inherit (module) specialArgs;
};
opts-doc = pkgs.nixosOptionsDoc { inherit (eval) options; }; opts-doc = pkgs.nixosOptionsDoc { inherit (eval) options; };
val = importJSON "${opts-doc.optionsJSON}/share/doc/nixos/options.json"; opts = importJSON "${opts-doc.optionsJSON}/share/doc/nixos/options.json";
filtered-opts = filterAttrs (name: _: name != "_module.args") val; filtered-opts = removeAttrs opts (attrNames ignored-opts);
result = json.generate "options-extranix.json" { result = json.generate "options-extranix.json" {
last_update = "-/-"; last_update = "-/-";
options = mapAttrsToList (title: val: { options = mapAttrsToList (title: val: {
@ -81,9 +90,17 @@ in
type = type =
let let
module-mod.options = { module-mod.options = {
specialArgs = mkOption {
type = types.attrs;
default = { };
};
paths = mkOption { paths = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
}; };
ignored-modules = mkOption {
type = types.listOf types.deferredModule;
default = [ ];
};
base = mkOption { base = mkOption {
type = types.path; type = types.path;
}; };