-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.nix
More file actions
57 lines (49 loc) · 1.16 KB
/
build.nix
File metadata and controls
57 lines (49 loc) · 1.16 KB
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
{
lib,
stdenv,
zephyr-nix,
pythonEnv,
cmake,
ninja,
west2nixHook,
bridleHook,
gitMinimal,
bridle,
app-path,
board,
target,
}:
stdenv.mkDerivation {
name = "helloshell";
meta.mainProgram = if (lib.strings.hasInfix board "native_sim") then "zephyr.exe" else null;
nativeBuildInputs = [
(zephyr-nix.sdk.override {
targets = [
target
];
})
west2nixHook
bridleHook
pythonEnv
zephyr-nix.hosttools-nix
gitMinimal
cmake
ninja
];
# Note: This should be set by the hook but it's tricky to get the ordering correct
dontUseCmakeConfigure = true;
CMAKE_PREFIX_PATH = "/build/bridle/share/bridle-package:/build/zephyr/share/zephyr-package";
src = bridle;
westBuildFlags = [
app-path
"-b"
board
];
installPhase = ''
mkdir -p $out/bin
[ -f build/zephyr/zephyr.exe ] && cp build/zephyr/zephyr.exe $out/bin || true
[ -f build/zephyr/zephyr.elf ] && cp build/zephyr/zephyr.elf $out/bin || true
[ -f build/zephyr/zephyr.bin ] && cp build/zephyr/zephyr.bin $out/bin || true
[ -f build/zephyr/zephyr.hex ] && cp build/zephyr/zephyr.hex $out/bin || true
'';
}