-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Searxng | ||
|
||
[Searxng](https://github.com/searxng/searxng) is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled. | ||
|
||
## Getting Started | ||
|
||
```nix | ||
# In `perSystem.process-compose.<name>` | ||
{ | ||
services.searxng."instance-name" = { | ||
enable = true; | ||
settings = { | ||
use_default_settings = true; | ||
server.port = 1234; | ||
server.bind_address = "127.0.0.1"; | ||
server.secret_key = "foobar"; | ||
}; | ||
}; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ in | |
./cassandra.nix | ||
./tempo.nix | ||
./weaviate.nix | ||
./searxng.nix | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
pkgs, | ||
lib, | ||
name, | ||
config, | ||
... | ||
}: | ||
let | ||
inherit (lib) types; | ||
|
||
settingType = | ||
with types; | ||
(oneOf [ | ||
bool | ||
int | ||
float | ||
str | ||
(listOf settingType) | ||
(attrsOf settingType) | ||
]) | ||
// { | ||
description = "JSON value"; | ||
}; | ||
in | ||
{ | ||
options = { | ||
enable = lib.mkEnableOption name; | ||
package = lib.mkPackageOption pkgs "searxng" { }; | ||
|
||
settings = lib.mkOption { | ||
type = types.attrsOf settingType; | ||
default = { | ||
use_default_settings = true; | ||
server.port = 8080; | ||
server.bind_address = "127.0.0.1"; | ||
server.secret_key = "secret"; | ||
server.limiter = false; | ||
}; | ||
example = lib.literalExpression '' | ||
{ | ||
use_default_settings = true; | ||
server.port = 8080; | ||
server.bind_address = "127.0.0.1"; | ||
server.secret_key = "secret"; | ||
} | ||
''; | ||
description = '' | ||
Searxng settings. These will be merged with (taking precedence over) | ||
the default configuration. It's also possible to refer to | ||
environment variables using the syntax `@VARIABLE_NAME@`. | ||
''; | ||
}; | ||
|
||
outputs.settings = lib.mkOption { | ||
type = types.deferredModule; | ||
internal = true; | ||
readOnly = true; | ||
default = { | ||
processes = { | ||
"${name}" = | ||
{ | ||
environment = { | ||
SEARXNG_SETTINGS_PATH = "${pkgs.writeText "settings.yml" (builtins.toJSON config.settings)}"; | ||
}; | ||
command = lib.getExe config.package; | ||
namespace = name; | ||
availability.restart = "on_failure"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ pkgs, ... }: | ||
{ | ||
services.searxng."searxng1".enable = true; | ||
|
||
settings.processes.test = { | ||
command = pkgs.writeShellApplication { | ||
runtimeInputs = [ pkgs.curl ]; | ||
text = '' | ||
curl http://127.0.0.1:8080 | ||
''; | ||
name = "searxng-test"; | ||
}; | ||
depends_on."searxng".condition = "process_healthy"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters