forked from adisbladis/zephyr-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
python.nix
35 lines (30 loc) · 945 Bytes
/
python.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ python3
, zephyr-src
, pyproject-nix
, clang-tools_17
, gitlint
, lib
}:
let
python = python3.override {
self = python;
packageOverrides = self: super: {
# HACK: Zephyr uses pypi to install non-Python deps
clang-format = clang-tools_17;
inherit gitlint;
# HACK: Older Zephyr depends on these missing dependencies
sphinxcontrib-svg2pdfconverter = super.sphinxcontrib-svg2pdfconverter or null;
};
};
project = pyproject-nix.lib.project.loadRequirementsTxt {
requirements = zephyr-src + "/scripts/requirements.txt";
};
invalidConstraints = project.validators.validateVersionConstraints { inherit python; };
in
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 ];
}))