summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ddgs/default.nix
blob: 8f31b08c6882754ef379b2819d6139addf3c3aab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  click,
  lxml,
  httpx,
  h2,
  fake-useragent,
  versionCheckHook,
}:

buildPythonPackage rec {
  pname = "ddgs";
  version = "9.10.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "deedy5";
    repo = "ddgs";
    tag = "v${version}";
    hash = "sha256-NNXGvDGynu6QtVqxVr74b/qehQ7qhq1NiVxyuKw2C4w=";
  };

  patches = [
    # We're removing the HTTP client primp below for security reasons,
    # but can use the already included httpx instead.
    # Note that while httpx is only used for HTTP/2 by upstream,
    # it can handle HTTP/1.1 just fine as well.
    ./replace-primp.patch
  ];

  pythonRemoveDeps = [
    # primp requires a very outdated, potentially insecure version of boringssl
    "primp"
  ];

  build-system = [ setuptools ];

  dependencies = [
    click
    lxml
    httpx
    h2
    fake-useragent
  ]
  ++ httpx.optional-dependencies.http2
  ++ httpx.optional-dependencies.socks
  ++ httpx.optional-dependencies.brotli;

  nativeCheckInputs = [ versionCheckHook ];
  versionCheckProgramArg = "version";

  pythonImportsCheck = [ "ddgs" ];

  meta = {
    description = "D.D.G.S. | Dux Distributed Global Search. A metasearch library that aggregates results from diverse web search services";
    mainProgram = "ddgs";
    homepage = "https://github.com/deedy5/ddgs";
    changelog = "https://github.com/deedy5/ddgs/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ drawbu ];
  };
}