2024-02-06 02:52:10 +00:00
|
|
|
{ python3
|
|
|
|
, zephyr-src
|
|
|
|
, pyproject-nix
|
|
|
|
, clang-tools
|
|
|
|
, gitlint
|
2024-02-06 06:41:46 +00:00
|
|
|
, lib
|
2024-02-06 02:52:10 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
python = python3.override {
|
|
|
|
self = python;
|
|
|
|
packageOverrides = self: super: {
|
2024-02-06 06:41:46 +00:00
|
|
|
# HACK: Zephyr uses pypi to install non-Python deps
|
2024-02-06 02:52:10 +00:00
|
|
|
clang-format = clang-tools;
|
|
|
|
inherit gitlint;
|
2024-02-06 06:41:46 +00:00
|
|
|
|
|
|
|
# HACK: Older Zephyr depends on these missing dependencies
|
|
|
|
sphinxcontrib-svg2pdfconverter = super.sphinxcontrib-svg2pdfconverter or null;
|
2024-02-06 02:52:10 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
project = pyproject-nix.lib.project.loadRequirementsTxt {
|
|
|
|
requirements = zephyr-src + "/scripts/requirements.txt";
|
|
|
|
};
|
|
|
|
|
2024-02-06 06:41:46 +00:00
|
|
|
invalidConstraints = project.validators.validateVersionConstraints { inherit python; };
|
|
|
|
|
2024-02-06 02:52:10 +00:00
|
|
|
in
|
2024-02-06 06:41:46 +00:00
|
|
|
lib.warnIf
|
|
|
|
(invalidConstraints != { })
|
|
|
|
"zephyr-pythonEnv: Found invalid Python constraints for: ${builtins.toJSON (lib.attrNames invalidConstraints)}"
|
|
|
|
(python.withPackages (project.renderers.withPackages {
|
|
|
|
inherit python;
|
|
|
|
extraPackages = ps: [ ps.west ];
|
|
|
|
}))
|