-
Notifications
You must be signed in to change notification settings - Fork 15
/
default.nix
89 lines (75 loc) · 1.75 KB
/
default.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
{ zephyr-src
, pyproject-nix
, lib
, newScope
, openocd
, gcc_multi
, autoreconfHook
, fetchFromGitHub
, python310
}:
lib.makeScope newScope (self: let
inherit (self) callPackage;
mkSdk = version: args: callPackage (import ./sdk.nix (lib.importJSON ./sdks/${version}.json)) args;
sdks = lib.fix (self: {
"0_17" = mkSdk "0_17" {
python3 = python310;
};
"0_16" = mkSdk "0_16" {
python3 = python310;
};
latest = self."0_17";
});
in {
inherit (sdks.latest) sdk sdkFull hosttools;
inherit sdks;
# Zephyr/west Python environment.
pythonEnv = callPackage ./python.nix {
inherit zephyr-src;
inherit pyproject-nix;
};
openocd-zephyr = openocd.overrideAttrs(old: let
pname = "openocd-zephyr";
version = "20220611";
in {
inherit pname version;
name = "${pname}-${version}";
nativeBuildInputs = old.nativeBuildInputs ++ [
autoreconfHook
];
src = fetchFromGitHub {
owner = "zephyrproject-rtos";
repo = "openocd";
rev = "b6f95a16c1360e347a06faf91befd122c0d15864";
hash = "sha256-NItD5vrFlm3vfma5DexRYpGDsrl7yLjgmskiXPpbYP8=";
};
});
# A variant of hosttools, but all tools are taken from nixpkgs.
hosttools-nix = callPackage
({ stdenv
, bossa
, dtc
, nettle
, openocd-zephyr
, qemu_full
, shared-mime-info
}: stdenv.mkDerivation {
name = "zephyr-sdk-hosttools-nix";
dontUnpack = true;
dontBuild = true;
propagatedBuildInputs = [
bossa
dtc
nettle
openocd-zephyr
qemu_full
shared-mime-info
]
++ lib.optional (stdenv.hostPlatform.system == "x86_64-linux") gcc_multi
;
installPhase = ''
mkdir $out
'';
})
{ };
})