1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 jsonschema,
7 pythonOlder,
8 rfc3987,
9 ruamel-yaml,
10 setuptools-scm,
11 libfdt,
12}:
13
14buildPythonPackage rec {
15 pname = "dtschema";
16 version = "2025.08";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "devicetree-org";
23 repo = "dt-schema";
24 tag = "v${version}";
25 sha256 = "sha256-SW2WAVB7ZSgKRjIyFdMqe8tRIuM97ZVBg4d0BJC6SBI=";
26 };
27
28 nativeBuildInputs = [ setuptools-scm ];
29
30 propagatedBuildInputs = [
31 jsonschema
32 rfc3987
33 ruamel-yaml
34 libfdt
35 ];
36
37 # Module has no tests
38 doCheck = false;
39
40 pythonImportsCheck = [ "dtschema" ];
41
42 meta = with lib; {
43 description = "Tooling for devicetree validation using YAML and jsonschema";
44 homepage = "https://github.com/devicetree-org/dt-schema/";
45 changelog = "https://github.com/devicetree-org/dt-schema/releases/tag/v${version}";
46 license = with licenses; [
47 bsd2 # or
48 gpl2Only
49 ];
50 maintainers = with maintainers; [ sorki ];
51
52 broken = (
53 # Library not loaded: @rpath/libfdt.1.dylib
54 stdenv.hostPlatform.isDarwin
55 ||
56
57 # see https://github.com/devicetree-org/dt-schema/issues/108
58 versionAtLeast jsonschema.version "4.18"
59 );
60 };
61}