at 25.11-pre 1.0 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonOlder, 6 rustPlatform, 7 libiconv, 8 fetchFromGitHub, 9}: 10let 11 pname = "nh3"; 12 version = "0.2.21"; 13 src = fetchFromGitHub { 14 owner = "messense"; 15 repo = pname; 16 rev = "v${version}"; 17 hash = "sha256-DskjcKjdz1HmKzmA568zRCjh4UK1/LBD5cSIu7Rfwok="; 18 }; 19in 20buildPythonPackage { 21 inherit pname version src; 22 format = "pyproject"; 23 disabled = pythonOlder "3.8"; 24 25 cargoDeps = rustPlatform.fetchCargoVendor { 26 inherit src; 27 name = "${pname}-${version}"; 28 hash = "sha256-1Ytca/GiHidR8JOcz+DydN6N/iguLchbP8Wnrd/0NTk="; 29 }; 30 31 nativeBuildInputs = with rustPlatform; [ 32 cargoSetupHook 33 maturinBuildHook 34 ]; 35 36 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ 37 libiconv 38 ]; 39 40 pythonImportsCheck = [ "nh3" ]; 41 42 meta = with lib; { 43 description = "Python binding to Ammonia HTML sanitizer Rust crate"; 44 homepage = "https://github.com/messense/nh3"; 45 license = licenses.mit; 46 maintainers = with maintainers; [ happysalada ]; 47 }; 48}