nixos: Add a quickpeepIndex service if an autoIndexUrl is specified

This commit is contained in:
Olivier 'reivilibre' 2023-03-21 23:31:17 +00:00
parent 0bebfc0025
commit 73c72bce25

View File

@ -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) {
#
# };
};
}