nix-config/modules/nixos-modules/server/searx/proxy.nix

32 lines
880 B
Nix

{
config,
lib,
...
}: {
options.services.searx = {
reverseProxy = {
domain = lib.mkOption {
type = lib.types.str;
description = "domain that searx will be hosted at";
default = "searx.arpa";
};
extraDomains = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "extra domains that should be configured for searx";
default = [];
};
};
};
config = lib.mkIf (config.services.searx.enable && config.services.reverseProxy.enable) {
services.reverseProxy.services.searx = {
target = "http://localhost:${toString config.services.searx.settings.server.port}";
domain = config.services.searx.reverseProxy.domain;
extraDomains = config.services.searx.reverseProxy.extraDomains;
settings = {
forwardHeaders.enable = true;
};
};
};
}