whoogle-search: init at 0.9.0, add module (#350730)

This commit is contained in:
Arne Keller
2024-12-18 18:52:29 +01:00
committed by GitHub
6 changed files with 175 additions and 0 deletions
@@ -38,6 +38,8 @@
- [Bat](https://github.com/sharkdp/bat), a {manpage}`cat(1)` clone with wings. Available as [programs.bat](options.html#opt-programs.bat).
- [Whoogle Search](https://github.com/benbusby/whoogle-search), a self-hosted, ad-free, privacy-respecting metasearch engine. Available as [services.whoogle-search](options.html#opt-services.whoogle-search.enable).
- [agorakit](https://github.com/agorakit/agorakit), an organization tool for citizens' collectives. Available with [services.agorakit](options.html#opt-services.agorakit.enable).
- [waagent](https://github.com/Azure/WALinuxAgent), the Microsoft Azure Linux Agent (waagent) manages Linux provisioning and VM interaction with the Azure Fabric Controller. Available with [services.waagent](options.html#opt-services.waagent.enable).
+1
View File
@@ -1291,6 +1291,7 @@
./services/networking/websockify.nix
./services/networking/wg-access-server.nix
./services/networking/wg-netmanager.nix
./services/networking/whoogle-search.nix
./services/networking/wvdial.nix
./services/networking/webhook.nix
./services/networking/wg-quick.nix
@@ -0,0 +1,70 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.whoogle-search;
in
{
options = {
services.whoogle-search = {
enable = lib.mkEnableOption "Whoogle, a metasearch engine";
port = lib.mkOption {
type = lib.types.port;
default = 5000;
description = "Port to listen on.";
};
listenAddress = lib.mkOption {
type = lib.types.str;
default = "127.0.0.1";
description = "Address to listen on for the web interface.";
};
extraEnv = lib.mkOption {
type = with lib.types; attrsOf str;
default = { };
description = ''
Extra environment variables to pass to Whoogle, see
https://github.com/benbusby/whoogle-search?tab=readme-ov-file#environment-variables
'';
};
};
};
config = lib.mkIf cfg.enable {
systemd.services.whoogle-search = {
description = "Whoogle Search";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.whoogle-search ];
environment = {
CONFIG_VOLUME = "/var/lib/whoogle-search";
} // cfg.extraEnv;
serviceConfig = {
Type = "simple";
ExecStart =
"${lib.getExe pkgs.whoogle-search}"
+ " --host '${cfg.listenAddress}'"
+ " --port '${builtins.toString cfg.port}'";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
StateDirectory = "whoogle-search";
StateDirectoryMode = "0750";
DynamicUser = true;
PrivateTmp = true;
ProtectSystem = true;
ProtectHome = true;
Restart = "on-failure";
RestartSec = "5s";
};
};
meta.maintainers = with lib.maintainers; [ malte-v ];
};
}
+1
View File
@@ -1149,6 +1149,7 @@ in {
webhook = runTest ./webhook.nix;
weblate = handleTest ./web-apps/weblate.nix {};
whisparr = handleTest ./whisparr.nix {};
whoogle-search = handleTest ./whoogle-search.nix {};
wiki-js = handleTest ./wiki-js.nix {};
wine = handleTest ./wine.nix {};
wireguard = handleTest ./wireguard {};
+24
View File
@@ -0,0 +1,24 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "whoogle-search";
meta.maintainers = with lib.maintainers; [ malte-v ];
nodes.machine =
{ pkgs, ... }:
{
services.whoogle-search = {
enable = true;
port = 5000;
listenAddress = "127.0.0.1";
};
};
testScript = ''
machine.start()
machine.wait_for_unit("whoogle-search.service")
machine.wait_for_open_port(5000)
machine.wait_until_succeeds("curl --fail --show-error --silent --location localhost:5000/")
'';
}
)
@@ -0,0 +1,77 @@
{
lib,
python3Packages,
fetchPypi,
nixosTests,
}:
python3Packages.buildPythonApplication rec {
pname = "whoogle-search";
version = "0.9.0";
pyproject = true;
src = fetchPypi {
pname = "whoogle_search";
inherit version;
hash = "sha256-JpTvt7A81gisijWaXu0Rh/vPwjA95hvmpzRBwjvByiI=";
};
build-system = with python3Packages; [ setuptools ];
dependencies = with python3Packages; [
attrs
beautifulsoup4
brotli
cachelib
certifi
cffi
chardet
click
cryptography
cssutils
defusedxml
flask
idna
itsdangerous
jinja2
markupsafe
more-itertools
packaging
pluggy
pycodestyle
pycparser
pyopenssl
pyparsing
pysocks
python-dateutil
requests
soupsieve
stem
urllib3
validators
waitress
wcwidth
werkzeug
python-dotenv
];
postInstall = ''
# This creates renamed versions of the static files for cache busting,
# without which whoogle will not run. If we don't do this here, whoogle
# will attempt to create them on startup, which fails since the nix store
# is read-only.
python3 $out/${python3Packages.python.sitePackages}/app/__init__.py
'';
passthru.tests = {
inherit (nixosTests) whoogle-search;
};
meta = {
homepage = "https://github.com/benbusby/whoogle-search";
description = "A self-hosted, ad-free, privacy-respecting metasearch engine";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ malte-v ];
mainProgram = "whoogle-search";
};
}