mirror of
https://github.com/juspay/services-flake.git
synced 2024-09-11 12:26:04 +03:00
**PR description** - The user can now set `namespace` for the processes under each service - Default namespace is now `${service}.${name}` (previously, just `${name}`) **Tasks** - [x] Do this for postgres, to begin with. - [x] Rest of the services ![image](https://github.com/juspay/services-flake/assets/3998/9ffea918-6481-42ad-ac47-cb5c1c81bd92) After the user overrides it: <img width="460" alt="image" src="https://github.com/juspay/services-flake/assets/3998/da6fb51e-e39f-4c33-bb47-e6b7cfd8c2b5"> After the user overrides the local processes as well: <img width="460" alt="image" src="https://github.com/juspay/services-flake/assets/3998/ae493309-4449-4cde-b239-c6e234b9f8af">
82 lines
2.1 KiB
Nix
82 lines
2.1 KiB
Nix
{ pkgs, lib, name, config, ... }:
|
|
let
|
|
inherit (lib) types;
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
in
|
|
{
|
|
options = {
|
|
enable = lib.mkEnableOption name;
|
|
package = lib.mkPackageOption pkgs "searxng" { };
|
|
|
|
host = lib.mkOption {
|
|
description = "Searxng bind address";
|
|
default = "127.0.0.1";
|
|
type = types.str;
|
|
};
|
|
|
|
port = lib.mkOption {
|
|
description = "Searxng port to listen on";
|
|
default = 8080;
|
|
type = types.port;
|
|
};
|
|
|
|
use_default_settings = lib.mkOption {
|
|
description = "Use default Searxng settings";
|
|
default = true;
|
|
type = types.bool;
|
|
};
|
|
|
|
secret_key = lib.mkOption {
|
|
description = "Searxng secret key";
|
|
default = "secret";
|
|
example = "secret-key";
|
|
type = types.str;
|
|
};
|
|
|
|
settings = lib.mkOption {
|
|
type = yamlFormat.type;
|
|
default = { };
|
|
example = lib.literalExpression ''
|
|
{
|
|
doi_resolvers."dummy" = "http://example.org";
|
|
default_doi_resolver = "dummy";
|
|
}
|
|
'';
|
|
description = ''
|
|
Searxng settings
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = {
|
|
outputs = {
|
|
settings = {
|
|
processes = {
|
|
"${name}" = {
|
|
environment = {
|
|
SEARXNG_SETTINGS_PATH = "${yamlFormat.generate "settings.yaml" (
|
|
lib.recursiveUpdate config.settings {
|
|
server.bind_address = config.host;
|
|
server.port = config.port;
|
|
server.secret_key = config.secret_key;
|
|
use_default_settings = config.use_default_settings;
|
|
}
|
|
)}";
|
|
};
|
|
command = lib.getExe config.package;
|
|
availability.restart = "on_failure";
|
|
readiness_probe = {
|
|
exec.command = "${lib.getExe pkgs.curl} -f -k http://${config.host}:${toString config.port}";
|
|
initial_delay_seconds = 5;
|
|
period_seconds = 10;
|
|
timeout_seconds = 2;
|
|
success_threshold = 1;
|
|
failure_threshold = 5;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|