at master 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 = "nh3"; 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 pname version src; 27 hash = "sha256-1Ytca/GiHidR8JOcz+DydN6N/iguLchbP8Wnrd/0NTk="; 28 }; 29 30 nativeBuildInputs = with rustPlatform; [ 31 cargoSetupHook 32 maturinBuildHook 33 ]; 34 35 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ 36 libiconv 37 ]; 38 39 pythonImportsCheck = [ "nh3" ]; 40 41 meta = with lib; { 42 description = "Python binding to Ammonia HTML sanitizer Rust crate"; 43 homepage = "https://github.com/messense/nh3"; 44 license = licenses.mit; 45 maintainers = with maintainers; [ happysalada ]; 46 }; 47}