1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5
6# build-system
7, rustPlatform
8
9# native darwin dependencies
10, libiconv
11, Security
12
13# tests
14, pytestCheckHook
15, hypothesis
16}:
17
18buildPythonPackage rec {
19 pname = "css-inline";
20 version = "0.9.0";
21 format = "pyproject";
22
23 src = fetchFromGitHub {
24 owner = "Stranger6667";
25 repo = "css-inline";
26 rev = "python-v${version}";
27 hash = "sha256-JyciyXElGDvZgjfL0yz9KhCCDu9ZRZvOn8LwkmfYKSg=";
28 };
29
30 postPatch = ''
31 cd bindings/python
32 ln -s ${./Cargo.lock} Cargo.lock
33 '';
34
35 cargoDeps = rustPlatform.fetchCargoTarball {
36 inherit src;
37 postPatch = ''
38 cd bindings/python
39 ln -s ${./Cargo.lock} Cargo.lock
40 '';
41 name = "${pname}-${version}";
42 hash = "sha256-9oLVMcrAB3JX9XSN5uBvrazFFG6J6s6V3HnEfz/qj2E=";
43 };
44
45 nativeBuildInputs = [
46 rustPlatform.cargoSetupHook
47 rustPlatform.maturinBuildHook
48 ];
49
50 buildInputs = lib.optionals stdenv.isDarwin [
51 libiconv
52 Security
53 ];
54
55 pythonImportsCheck = [
56 "css_inline"
57 ];
58
59 nativeCheckInputs = [
60 hypothesis
61 pytestCheckHook
62 ];
63
64 meta = with lib; {
65 description = "Inline CSS into style attributes";
66 homepage = "https://github.com/Stranger6667/css-inline";
67 changelog = "https://github.com/Stranger6667/css-inline/blob/${src.rev}/CHANGELOG.md";
68 license = licenses.mit;
69 maintainers = with maintainers; [ hexa ];
70 };
71}