nixos/searx: add configuration for favicons settings

see searxng docs: https://docs.searxng.org/admin/searx.favicons.html
This commit is contained in:
GiggleSquid
2025-03-13 03:58:21 +00:00
parent f66b515210
commit 461be7d8c8
2 changed files with 39 additions and 2 deletions
@@ -570,6 +570,8 @@
- `services.kmonad` now creates a determinate symlink (in `/dev/input/by-id/`) to each of KMonad virtual devices.
- `services.searx` now supports configuration of the favicons cache and other options available in SearXNG's `favicons.toml` file
- `services.gitea` now supports CAPTCHA usage through the `services.gitea.captcha` variable.
- `services.soft-serve` now restarts upon config change.
+37 -2
View File
@@ -11,6 +11,7 @@ let
(builtins.toJSON cfg.settings);
limiterSettingsFile = (pkgs.formats.toml { }).generate "limiter.toml" cfg.limiterSettings;
faviconsSettingsFile = (pkgs.formats.toml { }).generate "favicons.toml" cfg.faviconsSettings;
generateConfig = ''
cd ${runDir}
@@ -143,6 +144,35 @@ in
'';
};
faviconsSettings = mkOption {
type = types.attrsOf settingType;
default = { };
example = literalExpression ''
{
favicons = {
cfg_schema = 1;
cache = {
db_url = "/run/searx/faviconcache.db";
HOLD_TIME = 5184000;
LIMIT_TOTAL_BYTES = 2147483648;
BLOB_MAX_BYTES = 40960;
MAINTENANCE_MODE = "auto";
MAINTENANCE_PERIOD = 600;
};
};
}
'';
description = ''
Favicons settings for SearXNG.
::: {.note}
For available settings, see the SearXNG
[schema file](https://github.com/searxng/searxng/blob/master/searx/favicons/favicons.toml).
:::
'';
};
package = mkPackageOption pkgs "searxng" { };
runInUwsgi = mkOption {
@@ -263,8 +293,13 @@ in
port = 0;
};
environment.etc."searxng/limiter.toml" = lib.mkIf (cfg.limiterSettings != { }) {
source = limiterSettingsFile;
environment.etc = {
"searxng/limiter.toml" = lib.mkIf (cfg.limiterSettings != { }) {
source = limiterSettingsFile;
};
"searxng/favicons.toml" = lib.mkIf (cfg.faviconsSettings != { }) {
source = faviconsSettingsFile;
};
};
};