From 06cc579839d8df61cb0f94fa082a719f31b3dd0b Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 24 May 2022 19:38:07 +0200 Subject: [PATCH] packages/searxng: init --- packages/projects.nix | 14 ++++++- packages/web-apps/searxng/default.nix | 55 +++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 packages/web-apps/searxng/default.nix diff --git a/packages/projects.nix b/packages/projects.nix index 1041fce..e25e5de 100644 --- a/packages/projects.nix +++ b/packages/projects.nix @@ -1,6 +1,7 @@ { pkgs, inputs, system, ... }@args: let inherit (pkgs) lib; + inherit (inputs) unstable; dream2nix = inputs.dream2nix.lib2.init { systems = [ system ]; config = { @@ -13,9 +14,10 @@ let }); mkShell = import lib/devshell.nix args; + in { - packages = { + packages = rec { ghost = let version = "4.41.3"; dream = dream2nix.makeFlakeOutputs { @@ -53,6 +55,16 @@ in meta.mainProgram = "reflex"; }; + searxng = let + scope = pkgs.python3Packages.overrideScope (final: prev: let + pullDownPackages = pypkgs: lib.genAttrs pypkgs (pkgName: + final.callPackage "${unstable}/pkgs/development/python-modules/${pkgName}/default.nix" {} + ); + in pullDownPackages [ "httpcore" "httpx" "httpx-socks" "h2" "python-socks" "socksio" ]); + in pkgs.callPackage ./web-apps/searxng rec { + python3Packages = scope; + }; + sips = pkgs.callPackage ./servers/sips { }; }; diff --git a/packages/web-apps/searxng/default.nix b/packages/web-apps/searxng/default.nix new file mode 100644 index 0000000..131d069 --- /dev/null +++ b/packages/web-apps/searxng/default.nix @@ -0,0 +1,55 @@ +{ lib, nixosTests, python3, python3Packages, fetchFromGitHub, fetchpatch }: + +with python3Packages; + +toPythonModule (buildPythonApplication rec { + pname = "searxng"; + version = "20220520"; + + src = fetchFromGitHub { + owner = "searxng"; + repo = "searxng"; + rev = "61535a4c206aa247a6fa87697b70668048086e27"; + sha256 = "sha256-Ek/YZ4YzXxA/spmEAgcqItSmsYa/aVTeOBZbFPqNpJ4="; + }; + + postPatch = '' + sed -i 's/==.*$//' requirements.txt + ''; + + preBuild = '' + export SEARX_DEBUG="true"; + ''; + + propagatedBuildInputs = [ + Babel + certifi + python-dateutil + flask + flaskbabel + brotli + jinja2 + langdetect + lxml + h2 + pygments + pyyaml + redis + uvloop + setproctitle + httpx + httpx-socks + markdown-it-py + ]; + + # tests try to connect to network + doCheck = false; + + pythonImportsCheck = [ "searx" ]; + + postInstall = '' + # Create a symlink for easier access to static data + mkdir -p $out/share + ln -s ../${python3.sitePackages}/searx/static $out/share/ + ''; +})