forked from mirrors/nixpkgs
searx: add module
This commit is contained in:
parent
bba7fb62e8
commit
7e932ca4e2
|
@ -115,6 +115,7 @@
|
|||
nix-ssh = 104;
|
||||
dictd = 105;
|
||||
couchdb = 106;
|
||||
searx = 107;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid.
|
||||
|
||||
|
@ -208,6 +209,7 @@
|
|||
keys = 96;
|
||||
dictd = 105;
|
||||
couchdb = 106;
|
||||
searx = 107;
|
||||
|
||||
# When adding a gid, make sure it doesn't match an existing uid.
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@
|
|||
./services/networking/rdnssd.nix
|
||||
./services/networking/rpcbind.nix
|
||||
./services/networking/sabnzbd.nix
|
||||
./services/networking/searx.nix
|
||||
./services/networking/supybot.nix
|
||||
./services/networking/ssh/lshd.nix
|
||||
./services/networking/ssh/sshd.nix
|
||||
|
|
76
nixos/modules/services/networking/searx.nix
Normal file
76
nixos/modules/services/networking/searx.nix
Normal file
|
@ -0,0 +1,76 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.searx;
|
||||
|
||||
configFile = cfg.configFile;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
services.searx = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Searx server.
|
||||
";
|
||||
};
|
||||
|
||||
configFile = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
The path of the Searx server configuration file. If no file
|
||||
is specified, a default file is used (default config file has
|
||||
debug mode enabled).
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf config.services.searx.enable {
|
||||
|
||||
users.extraUsers.searx =
|
||||
{ uid = config.ids.uids.searx;
|
||||
description = "Searx user";
|
||||
createHome = true;
|
||||
home = "/var/lib/searx";
|
||||
};
|
||||
|
||||
users.extraGroups.searx =
|
||||
{ gid = config.ids.gids.searx;
|
||||
};
|
||||
|
||||
systemd.services.searx =
|
||||
{
|
||||
description = "Searx server, the meta search engine.";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.User = "searx";
|
||||
script = ''
|
||||
if [ -z "${configFile}" ]; then
|
||||
exec ${pkgs.pythonPackages.searx}/bin/searx-run
|
||||
else
|
||||
SEARX_SETTINGS_PATH="${configFile}" exec ${pkgs.pythonPackages.searx}/bin/searx-run
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.pythonPackages.searx ];
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue