This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
99 lines (80 loc) · 1.99 KB
/
flake.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
description = "Development shell for i2c_obs";
inputs = {
nixpkgs.follows = "hdx/nixpkgs";
flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
hdx.url = github:charlottia/hdx;
};
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
flake-compat,
...
}: let
overlays = [
(final: prev: {
hdx = inputs.hdx.packages.${prev.system};
})
];
in
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit overlays system;};
hdx = pkgs.hdx.default;
inherit (pkgs) lib;
inherit (hdx) python;
in rec {
formatter = pkgs.alejandra;
packages.default = python.pkgs.buildPythonPackage {
name = "i2c_obs";
format = "pyproject";
src = ./.;
nativeBuildInputs = builtins.attrValues {
inherit
(python.pkgs)
setuptools
black
isort
python-lsp-server
pyserial
;
inherit
(pkgs.nodePackages)
pyright
;
inherit
(pkgs)
dfu-util
;
inherit
hdx
;
};
# dontAddExtraLibs = true;
doCheck = true;
pythonImportsCheck = ["i2c_obs"];
checkPhase = ''
BOARDS=( icebreaker orangecrab )
SPEEDS=( 100000 400000 )
export CI=1
set -euo pipefail
echo "--- Unit tests."
python -m i2c_obs test
for board in "''${BOARDS[@]}"; do
for speed in "''${SPEEDS[@]}"; do
echo "--- Building $board @ $speed."
python -m i2c_obs build "$board" -s "$speed"
done
done
echo "--- Formal verification."
python -m i2c_obs formal
echo "--- All passed."
'';
};
checks.default = packages.default;
devShells.default = packages.default;
});
}