Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 rustPlatform, 9 10 # native darwin dependencies 11 libiconv, 12 Security, 13 SystemConfiguration, 14 15 # tests 16 pytestCheckHook, 17 hypothesis, 18}: 19 20buildPythonPackage rec { 21 pname = "css-inline"; 22 version = "0.14.1"; 23 pyproject = true; 24 25 src = fetchFromGitHub { 26 owner = "Stranger6667"; 27 repo = "css-inline"; 28 rev = "python-v${version}"; 29 hash = "sha256-+hX05y+ii2/wAbcc3SPK3ns4slUKFGqHURb3Z08yhVw="; 30 }; 31 32 postPatch = '' 33 cd bindings/python 34 ln -s ${./Cargo.lock} Cargo.lock 35 ''; 36 37 # call `cargo build --release` in bindings/python and copy the 38 # resulting lock file 39 cargoDeps = rustPlatform.fetchCargoTarball { 40 inherit src; 41 postPatch = '' 42 cd bindings/python 43 ln -s ${./Cargo.lock} Cargo.lock 44 ''; 45 name = "${pname}-${version}"; 46 hash = "sha256-ogzj8JxiFX2VWEeEnKACycd2Bud9VUpLuF4h35eUls0="; 47 }; 48 49 nativeBuildInputs = [ 50 rustPlatform.cargoSetupHook 51 rustPlatform.maturinBuildHook 52 ]; 53 54 buildInputs = lib.optionals stdenv.isDarwin [ 55 libiconv 56 Security 57 SystemConfiguration 58 ]; 59 60 pythonImportsCheck = [ "css_inline" ]; 61 62 nativeCheckInputs = [ 63 hypothesis 64 pytestCheckHook 65 ]; 66 67 disabledTests = 68 [ 69 # fails to connect to local server 70 "test_cache" 71 "test_remote_stylesheet" 72 ] 73 ++ lib.optionals (stdenv.isDarwin) [ 74 # pyo3_runtime.PanicException: event loop thread panicked 75 "test_invalid_href" 76 ]; 77 78 meta = with lib; { 79 description = "Inline CSS into style attributes"; 80 homepage = "https://github.com/Stranger6667/css-inline"; 81 changelog = "https://github.com/Stranger6667/css-inline/blob/${src.rev}/CHANGELOG.md"; 82 license = licenses.mit; 83 maintainers = with maintainers; [ hexa ]; 84 }; 85}