2024-05-15 15:35:15 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
click,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
|
|
|
orjson,
|
|
|
|
curl-cffi,
|
|
|
|
|
|
|
|
# To build orjson
|
|
|
|
rustPlatform,
|
|
|
|
|
|
|
|
# Optional dependencies
|
|
|
|
lxml,
|
2023-04-12 12:48:02 +00:00
|
|
|
}:
|
2024-05-15 15:35:15 +00:00
|
|
|
let
|
|
|
|
curl-cffi_0_7_0 = curl-cffi.overrideAttrs (
|
|
|
|
final: old: {
|
|
|
|
version = "0.7.0b4";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "yifeikong";
|
|
|
|
repo = "curl_cffi";
|
|
|
|
rev = "v${final.version}";
|
|
|
|
hash = "sha256-txrJNUzswAPeH4Iazn0iKJI0Rqk0HHRoDrtTfDHKMoo=";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
orjson_3_10_3 = orjson.overrideAttrs (
|
|
|
|
final: old: {
|
|
|
|
version = "3.10.3";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ijl";
|
|
|
|
repo = "orjson";
|
|
|
|
rev = "refs/tags/${final.version}";
|
|
|
|
hash = "sha256-bK6wA8P/IXEbiuJAx7psd0nUUKjR1jX4scFfJr1MBAk=";
|
|
|
|
};
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit (final) src;
|
|
|
|
name = "${old.pname}-${final.version}";
|
|
|
|
hash = "sha256-ilGq+/gPSuNwURUWy2ZxInzmUv+PxYMxd8esxrMpr2o=";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
in
|
2023-04-12 12:48:02 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "duckduckgo-search";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "v5.3.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.8";
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "deedy5";
|
|
|
|
repo = "duckduckgo_search";
|
2024-05-15 15:35:15 +00:00
|
|
|
rev = version;
|
|
|
|
hash = "sha256-T7rlB3dU7y+HbHr1Ss9KkejlXFORhnv9Va7cFTRtfQU=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
click
|
2024-05-15 15:35:15 +00:00
|
|
|
orjson_3_10_3
|
|
|
|
curl-cffi_0_7_0
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
lxml = [ lxml ];
|
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = false; # tests require network access
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "duckduckgo_search" ];
|
|
|
|
|
|
|
|
meta = {
|
2024-01-02 11:29:13 +00:00
|
|
|
description = "Python CLI and library for searching for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "ddgs";
|
2023-04-12 12:48:02 +00:00
|
|
|
homepage = "https://github.com/deedy5/duckduckgo_search";
|
2024-05-15 15:35:15 +00:00
|
|
|
changelog = "https://github.com/deedy5/duckduckgo_search/releases/tag/${version}";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ drawbu ];
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
}
|