fix(son-doc): file miss in documentation
This commit is contained in:
parent
a4a9ae9e12
commit
02c565bb9d
2 changed files with 83 additions and 29 deletions
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
modulesPath,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -94,8 +93,12 @@
|
||||||
"${netconf.outPath}/junos"
|
"${netconf.outPath}/junos"
|
||||||
"${netconf.outPath}/dgn-module.nix"
|
"${netconf.outPath}/dgn-module.nix"
|
||||||
];
|
];
|
||||||
base = netconf.outPath;
|
path-translations = [
|
||||||
url = "https://git.dgnum.eu/DGNum/Netconf-Module/src/branch/master/";
|
{
|
||||||
|
base = netconf.outPath;
|
||||||
|
url = "https://git.dgnum.eu/DGNum/Netconf-Module/src/branch/master/";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
"infra DGNum" =
|
"infra DGNum" =
|
||||||
let
|
let
|
||||||
|
@ -105,18 +108,27 @@
|
||||||
outputHash = "sha256-LhjQoVZqYARpUxuuWhcNY7HLE64H8PIIBZ0QwlmGD2I=";
|
outputHash = "sha256-LhjQoVZqYARpUxuuWhcNY7HLE64H8PIIBZ0QwlmGD2I=";
|
||||||
name = "DGN-infra";
|
name = "DGN-infra";
|
||||||
};
|
};
|
||||||
|
infra-hive = import "${infra}/hive.nix";
|
||||||
|
infra-source = infra-hive.meta.specialArgs.sources;
|
||||||
|
infra-nixpkgs = infra-hive.meta.nixpkgs { };
|
||||||
|
infra-modulesPath = "${infra-nixpkgs.path}/nixos/modules/";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
paths = [
|
paths = [
|
||||||
"${infra}/modules/generic"
|
"${infra}/modules/generic"
|
||||||
"${infra}/modules/nixos"
|
"${infra}/modules/nixos"
|
||||||
];
|
];
|
||||||
ignored-modules = import "${modulesPath}/module-list.nix";
|
ignored-modules = import "${infra-modulesPath}/module-list.nix" ++ [
|
||||||
|
"${infra-source.agenix}/modules/age.nix"
|
||||||
|
"${infra-source.arkheon}/module.nix"
|
||||||
|
"${infra-source."microvm.nix"}/nixos-modules/host"
|
||||||
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
lib = lib // {
|
lib = infra-nixpkgs.lib // {
|
||||||
extra = import "${infra}/lib/nix-lib";
|
extra = import "${infra}/lib/nix-lib";
|
||||||
};
|
};
|
||||||
inherit pkgs modulesPath;
|
modulesPath = infra-modulesPath;
|
||||||
|
pkgs = infra-nixpkgs;
|
||||||
name = "<nodeName>";
|
name = "<nodeName>";
|
||||||
nodeMeta = {
|
nodeMeta = {
|
||||||
nix-modules = [ ];
|
nix-modules = [ ];
|
||||||
|
@ -126,10 +138,26 @@
|
||||||
meta = {
|
meta = {
|
||||||
organization.groups.root = [ ];
|
organization.groups.root = [ ];
|
||||||
};
|
};
|
||||||
sources = (import "${infra}/hive.nix").meta.specialArgs.sources;
|
sources = infra-source;
|
||||||
};
|
};
|
||||||
base = infra.outPath;
|
path-translations = [
|
||||||
url = "https://git.dgnum.eu/DGNum/infrastructure/src/branch/main/";
|
{
|
||||||
|
base = infra.outPath;
|
||||||
|
url = "https://git.dgnum.eu/DGNum/infrastructure/src/branch/main/";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
base = infra-source.nix-modules;
|
||||||
|
url = "https://git.hubrecht.ovh/hubrecht/nix-modules/src/branch/main/";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
base = infra-modulesPath;
|
||||||
|
url = "https://github.com/NixOS/nixpkgs/tree/master/nixos/modules";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
base = infra-source.cgroup-exporter;
|
||||||
|
url = "https://github.com/arianvp/cgroup-exporter/blob/main/";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static-data = ./static-data;
|
static-data = ./static-data;
|
||||||
|
|
|
@ -16,7 +16,10 @@ let
|
||||||
removePrefix
|
removePrefix
|
||||||
pathIsDirectory
|
pathIsDirectory
|
||||||
hasSuffix
|
hasSuffix
|
||||||
|
hasPrefix
|
||||||
attrNames
|
attrNames
|
||||||
|
filter
|
||||||
|
head
|
||||||
;
|
;
|
||||||
inherit (lib.strings)
|
inherit (lib.strings)
|
||||||
sanitizeDerivationName
|
sanitizeDerivationName
|
||||||
|
@ -26,7 +29,7 @@ let
|
||||||
cfg = config.services.extranix;
|
cfg = config.services.extranix;
|
||||||
|
|
||||||
module-eval =
|
module-eval =
|
||||||
module:
|
module-name: module:
|
||||||
let
|
let
|
||||||
ignored-eval = lib.evalModules {
|
ignored-eval = lib.evalModules {
|
||||||
modules = module.ignored-modules;
|
modules = module.ignored-modules;
|
||||||
|
@ -41,6 +44,33 @@ let
|
||||||
opts-doc = pkgs.nixosOptionsDoc { inherit (eval) options; };
|
opts-doc = pkgs.nixosOptionsDoc { inherit (eval) options; };
|
||||||
opts = importJSON "${opts-doc.optionsJSON}/share/doc/nixos/options.json";
|
opts = importJSON "${opts-doc.optionsJSON}/share/doc/nixos/options.json";
|
||||||
filtered-opts = removeAttrs opts (attrNames ignored-opts);
|
filtered-opts = removeAttrs opts (attrNames ignored-opts);
|
||||||
|
path-translation =
|
||||||
|
let
|
||||||
|
translations = map (
|
||||||
|
{ base, url }:
|
||||||
|
{
|
||||||
|
url = "${url}${if hasSuffix "/" url then "" else "/"}";
|
||||||
|
base =
|
||||||
|
let
|
||||||
|
base1 = toString base;
|
||||||
|
in
|
||||||
|
base1 + (if hasSuffix "/" base1 then "" else "/");
|
||||||
|
}
|
||||||
|
) module.path-translations;
|
||||||
|
in
|
||||||
|
path:
|
||||||
|
let
|
||||||
|
fullPath = path + (if pathIsDirectory path then "/default.nix" else "");
|
||||||
|
fitting = filter ({ base, ... }: hasPrefix base fullPath) translations;
|
||||||
|
translate-info = head (
|
||||||
|
fitting ++ [ (throw "${fullPath} is not in any base path of ${module-name}") ]
|
||||||
|
);
|
||||||
|
innerPath = removePrefix translate-info.base fullPath;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "<${innerPath}>";
|
||||||
|
url = "${translate-info.url}${innerPath}";
|
||||||
|
};
|
||||||
result = json.generate "options-extranix.json" {
|
result = json.generate "options-extranix.json" {
|
||||||
last_update = "-/-";
|
last_update = "-/-";
|
||||||
options = mapAttrsToList (title: val: {
|
options = mapAttrsToList (title: val: {
|
||||||
|
@ -53,19 +83,7 @@ let
|
||||||
;
|
;
|
||||||
example = val.example.text or "";
|
example = val.example.text or "";
|
||||||
default = val.default.text or "";
|
default = val.default.text or "";
|
||||||
declarations = map (
|
declarations = map path-translation val.declarations;
|
||||||
decl:
|
|
||||||
let
|
|
||||||
baseString1 = toString module.base;
|
|
||||||
baseString = baseString1 + (if hasSuffix "/" baseString1 then "" else "/");
|
|
||||||
innerPath1 = if pathIsDirectory decl then decl + "/default.nix" else decl;
|
|
||||||
innerPath = removePrefix baseString innerPath1;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
name = "<${innerPath}>";
|
|
||||||
url = "${module.url}${if hasSuffix "/" module.url then "" else "/"}${innerPath}";
|
|
||||||
}
|
|
||||||
) val.declarations;
|
|
||||||
}) filtered-opts;
|
}) filtered-opts;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -73,7 +91,7 @@ let
|
||||||
|
|
||||||
options-files = mapAttrs' (name: value: {
|
options-files = mapAttrs' (name: value: {
|
||||||
name = sanitizeDerivationName name;
|
name = sanitizeDerivationName name;
|
||||||
value = module-eval value;
|
value = module-eval name value;
|
||||||
}) cfg.modules;
|
}) cfg.modules;
|
||||||
|
|
||||||
webroot = pkgs.callPackage ./webroot.nix {
|
webroot = pkgs.callPackage ./webroot.nix {
|
||||||
|
@ -101,11 +119,19 @@ in
|
||||||
type = types.listOf types.deferredModule;
|
type = types.listOf types.deferredModule;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
base = mkOption {
|
path-translations = mkOption {
|
||||||
type = types.path;
|
type =
|
||||||
};
|
let
|
||||||
url = mkOption {
|
path-mod.options = {
|
||||||
type = types.str;
|
base = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
};
|
||||||
|
url = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
types.listOf (types.submodule path-mod);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue