2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
rustPlatform,
|
|
|
|
libiconv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
darwin,
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "nh3";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.2.17";
|
2023-07-15 17:15:38 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "messense";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-j9OoXAuuCWsBHanN+SzSip94ZA+kY8HUVvfY/omUSSM=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version src;
|
|
|
|
format = "pyproject";
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-WomlVzKOUfcgAWGJInSvZn9hm+bFpgc4nJbRiyPCU64=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = with rustPlatform; [
|
|
|
|
cargoSetupHook
|
|
|
|
maturinBuildHook
|
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
2023-07-15 17:15:38 +00:00
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "nh3" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python binding to Ammonia HTML sanitizer Rust crate";
|
|
|
|
homepage = "https://github.com/messense/nh3";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ happysalada ];
|
|
|
|
};
|
|
|
|
}
|