searx: refactor a bit

This commit is contained in:
Domen Kozar 2014-03-09 18:57:17 +01:00
parent 7e932ca4e2
commit f0b34fe8ff

View File

@ -21,7 +21,7 @@ in
enable = mkOption {
default = false;
description = "
Whether to enable the Searx server.
Whether to enable the Searx server. See https://github.com/asciimoo/searx
";
};
@ -59,15 +59,14 @@ in
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
'';
};
serviceConfig = {
User = "searx";
ExecStart = "${pkgs.pythonPackages.searx}/bin/searx-run";
};
} // (optionalAttrs (configFile != "") {
environment.SEARX_SETTINGS_PATH = configFile;
});
environment.systemPackages = [ pkgs.pythonPackages.searx ];