From 9e9c2a4fcf4d1c8a59af06e95ae507d876eca93a Mon Sep 17 00:00:00 2001 From: catvayor Date: Sun, 22 Dec 2024 01:05:22 +0100 Subject: [PATCH] refactor(extranix): move module declaration and give descriptions --- REUSE.toml | 2 +- default.nix | 10 ++-- machines/nixos/compute01/search/default.nix | 3 - modules/nixos/default.nix | 1 + .../0001-revert-don-t-parse-md-in-js.patch | 0 ...02-chore-remove-useless-dependencies.patch | 0 ...e-HTML-description-of-MD-description.patch | 0 .../0004-fix-indentation-of-ul.patch | 0 ...-feat-match-all-substring-by-default.patch | 0 .../nixos/extranix/default.nix | 57 +++++++++++++++++++ .../hugo-theme-extranix-options-search.nix | 0 .../nixos/extranix}/webroot.nix | 0 12 files changed, 64 insertions(+), 9 deletions(-) rename {machines/nixos/compute01/search => modules/nixos/extranix}/0001-revert-don-t-parse-md-in-js.patch (100%) rename {machines/nixos/compute01/search => modules/nixos/extranix}/0002-chore-remove-useless-dependencies.patch (100%) rename {machines/nixos/compute01/search => modules/nixos/extranix}/0003-feat-separate-HTML-description-of-MD-description.patch (100%) rename {machines/nixos/compute01/search => modules/nixos/extranix}/0004-fix-indentation-of-ul.patch (100%) rename {machines/nixos/compute01/search => modules/nixos/extranix}/0005-feat-match-all-substring-by-default.patch (100%) rename machines/nixos/compute01/search/module.nix => modules/nixos/extranix/default.nix (72%) rename {machines/nixos/compute01/search => modules/nixos/extranix}/hugo-theme-extranix-options-search.nix (100%) rename {machines/nixos/compute01/search => modules/nixos/extranix}/webroot.nix (100%) diff --git a/REUSE.toml b/REUSE.toml index 0a69701..5f94325 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -32,7 +32,7 @@ precedence = "closest" [[annotations]] SPDX-FileCopyrightText = "2024 Lubin Bailly " SPDX-License-Identifier = "EUPL-1.2" -path = ["machines/nixos/compute01/search/0001-revert-don-t-parse-md-in-js.patch", "machines/nixos/compute01/search/0002-chore-remove-useless-dependencies.patch", "machines/nixos/compute01/search/0003-feat-separate-HTML-description-of-MD-description.patch", "machines/nixos/compute01/search/0004-fix-indentation-of-ul.patch", "machines/nixos/compute01/search/0005-feat-match-all-substring-by-default.patch"] +path = ["modules/nixos/extranix/0001-revert-don-t-parse-md-in-js.patch", "modules/nixos/extranix/0002-chore-remove-useless-dependencies.patch", "modules/nixos/extranix/0003-feat-separate-HTML-description-of-MD-description.patch", "modules/nixos/extranix/0004-fix-indentation-of-ul.patch", "modules/nixos/extranix/0005-feat-match-all-substring-by-default.patch"] precedence = "closest" [[annotations]] diff --git a/default.nix b/default.nix index 7f6253f..d861ed1 100644 --- a/default.nix +++ b/default.nix @@ -103,11 +103,11 @@ let } { path = [ - "machines/nixos/compute01/search/0001-revert-don-t-parse-md-in-js.patch" - "machines/nixos/compute01/search/0002-chore-remove-useless-dependencies.patch" - "machines/nixos/compute01/search/0003-feat-separate-HTML-description-of-MD-description.patch" - "machines/nixos/compute01/search/0004-fix-indentation-of-ul.patch" - "machines/nixos/compute01/search/0005-feat-match-all-substring-by-default.patch" + "modules/nixos/extranix/0001-revert-don-t-parse-md-in-js.patch" + "modules/nixos/extranix/0002-chore-remove-useless-dependencies.patch" + "modules/nixos/extranix/0003-feat-separate-HTML-description-of-MD-description.patch" + "modules/nixos/extranix/0004-fix-indentation-of-ul.patch" + "modules/nixos/extranix/0005-feat-match-all-substring-by-default.patch" ]; copyright = "2024 Lubin Bailly "; } diff --git a/machines/nixos/compute01/search/default.nix b/machines/nixos/compute01/search/default.nix index 8538b5e..01e3df1 100644 --- a/machines/nixos/compute01/search/default.nix +++ b/machines/nixos/compute01/search/default.nix @@ -12,9 +12,6 @@ let host = "search.infra.dgnum.eu"; in { - imports = [ - ./module.nix - ]; services = { nginx.virtualHosts.${host} = { enableACME = true; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index cf35e71..cc1e316 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -32,6 +32,7 @@ "dgn-vm-variant" "dgn-web" "django-apps" + "extranix" ]) ++ [ "${sources.agenix}/modules/age.nix" diff --git a/machines/nixos/compute01/search/0001-revert-don-t-parse-md-in-js.patch b/modules/nixos/extranix/0001-revert-don-t-parse-md-in-js.patch similarity index 100% rename from machines/nixos/compute01/search/0001-revert-don-t-parse-md-in-js.patch rename to modules/nixos/extranix/0001-revert-don-t-parse-md-in-js.patch diff --git a/machines/nixos/compute01/search/0002-chore-remove-useless-dependencies.patch b/modules/nixos/extranix/0002-chore-remove-useless-dependencies.patch similarity index 100% rename from machines/nixos/compute01/search/0002-chore-remove-useless-dependencies.patch rename to modules/nixos/extranix/0002-chore-remove-useless-dependencies.patch diff --git a/machines/nixos/compute01/search/0003-feat-separate-HTML-description-of-MD-description.patch b/modules/nixos/extranix/0003-feat-separate-HTML-description-of-MD-description.patch similarity index 100% rename from machines/nixos/compute01/search/0003-feat-separate-HTML-description-of-MD-description.patch rename to modules/nixos/extranix/0003-feat-separate-HTML-description-of-MD-description.patch diff --git a/machines/nixos/compute01/search/0004-fix-indentation-of-ul.patch b/modules/nixos/extranix/0004-fix-indentation-of-ul.patch similarity index 100% rename from machines/nixos/compute01/search/0004-fix-indentation-of-ul.patch rename to modules/nixos/extranix/0004-fix-indentation-of-ul.patch diff --git a/machines/nixos/compute01/search/0005-feat-match-all-substring-by-default.patch b/modules/nixos/extranix/0005-feat-match-all-substring-by-default.patch similarity index 100% rename from machines/nixos/compute01/search/0005-feat-match-all-substring-by-default.patch rename to modules/nixos/extranix/0005-feat-match-all-substring-by-default.patch diff --git a/machines/nixos/compute01/search/module.nix b/modules/nixos/extranix/default.nix similarity index 72% rename from machines/nixos/compute01/search/module.nix rename to modules/nixos/extranix/default.nix index 5234933..5a8e5b0 100644 --- a/machines/nixos/compute01/search/module.nix +++ b/modules/nixos/extranix/default.nix @@ -136,13 +136,25 @@ in specialArgs = mkOption { type = types.attrs; default = { }; + description = '' + Special arguments to give to evalModules. + ''; }; paths = mkOption { type = types.listOf types.deferredModule; + description = '' + Modules to from which to document options. + ''; }; ignored-modules = mkOption { type = types.listOf types.deferredModule; default = [ ]; + description = '' + Modules required to make modules of `paths` valid. + ''; + example = '' + import "''${infra-modulesPath}/module-list.nix" + ''; }; path-translations = mkOption { type = @@ -150,26 +162,71 @@ in path-mod.options = { base = mkOption { type = types.path; + description = '' + Base path of some module files to be documented. + ''; }; url = mkOption { type = types.str; + description = '' + Url root to use for files on this path. + ''; }; }; in types.listOf (types.submodule path-mod); + description = '' + Rules to convert file paths to urls in the documentation to indicate where + the option is declared. + ''; }; }; in types.attrsOf (types.submodule module-mod); + description = '' + Sets of modules to be documented separately. The identifier to give for + `settings.params.release_current_stable` (which is the default module shown) is the key after + passing through `sanitizeDerivationName`. + ''; }; settings = mkOption { inherit (yaml) type; + description = '' + Settings for the `config.yaml` for the hugo instantiation. + ''; + example = { + baseUrl = "https://example.org/"; + title = "Module documentation"; + languageCode = "en-us"; + params = { + release_current_stable = "Some-Module"; + logo = "logo.png"; + footer_credits_line = '' + Based on Home Manager Option Search + ''; + footer_copyright_line = '' + Made by catvayor for the DGNum. + ''; + main_menu = [ + { + name = ''Sources''; + url = "https://git.example.org/"; + } + ]; + }; + }; }; static-data = mkOption { type = types.path; + description = '' + Static files for the website. Should have `images/favicon.png` for favicon. + ''; }; host = mkOption { type = types.str; + description = '' + Hostname of the service. + ''; }; }; config = mkIf cfg.enable { diff --git a/machines/nixos/compute01/search/hugo-theme-extranix-options-search.nix b/modules/nixos/extranix/hugo-theme-extranix-options-search.nix similarity index 100% rename from machines/nixos/compute01/search/hugo-theme-extranix-options-search.nix rename to modules/nixos/extranix/hugo-theme-extranix-options-search.nix diff --git a/machines/nixos/compute01/search/webroot.nix b/modules/nixos/extranix/webroot.nix similarity index 100% rename from machines/nixos/compute01/search/webroot.nix rename to modules/nixos/extranix/webroot.nix