From 73c72bce25ed457470c28a025cad94088d446420 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Tue, 21 Mar 2023 23:31:17 +0000 Subject: [PATCH] nixos: Add a quickpeepIndex service if an autoIndexUrl is specified --- nixos_modules/quickpeepSearch.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/nixos_modules/quickpeepSearch.nix b/nixos_modules/quickpeepSearch.nix index 4d07183..f331ebf 100644 --- a/nixos_modules/quickpeepSearch.nix +++ b/nixos_modules/quickpeepSearch.nix @@ -48,6 +48,15 @@ with lib; Config path to use, in RON format. ''; }; + + autoIndexUrl = mkOption { + default = null; + type = with types; nullOr str; + description = '' + HTTP(S) URL to an index (list) of rakepacks. + If specified, the indexer will periodically fetch new packs from that list and then add the pages within to the search index. + ''; + }; }; }; @@ -73,5 +82,19 @@ with lib; ExecStart = ''${quickpeep}/bin/quickpeep ${cfg.bindHost}:${builtins.toString cfg.bindPort}''; }; }; + + systemd.services.quickpeepIndex = mkIf (cfg.autoIndexUrl != null) { + after = [ "network.target" ]; + description = "Fetches rakepacks from a feed and adds pages to the search index."; + serviceConfig = { + Type = "simple"; + User = "${cfg.user}"; + ExecStart = ''${quickpeep}/bin/qp-indexer --config ${lib.strings.escapeShellArg cfg.configPath} --feed ${lib.strings.escapeShellArg cfg.autoIndexUrl}''; + }; + }; + +# TODO systemd.timers.quickpeepIndex = mkIf (cfg.autoIndexUrl != null) { +# +# }; }; }