packages/shells/zephyr/default.nix

35 lines
1 KiB
Nix
Raw Normal View History

2023-12-02 00:57:07 +00:00
{ lib, mkShell, zephyrPackages, cmake, ninja, gnumake, python3
, toolchains ? with zephyrPackages.toolchains; [ arm-zephyr-eabi ]
, enableWest ? false, zephyrSrc ? zephyrPackages.src, modules ? [ ]
, extraPackages ? [ ], extraAttrs ? { } }:
let zephyr-sdk = zephyrPackages.sdk.override { inherit toolchains; };
in mkShell ({
packages = [ cmake ninja gnumake python3 ] ++ (with python3.pkgs;
[
# requirements-base.txt
pyelftools
pyyaml
pykwalify
canopen
packaging
progress
psutil
pylink-square
pyserial
requests
anytree
intelhex
] ++ lib.optional enableWest python3.pkgs.west ++ extraPackages);
2023-11-12 05:10:09 +00:00
ZEPHYR_TOOLCHAIN_VARIANT = "zephyr";
ZEPHYR_SDK_INSTALL_DIR = "${zephyr-sdk}";
} // lib.optionalAttrs (zephyrSrc != null) {
ZEPHYR_BASE = "${zephyrSrc}";
shellHook = ''
PATH="${zephyrSrc}/scripts:$PATH"
'';
} // lib.optionalAttrs (modules != [ ]) {
ZEPHYR_MODULES =
lib.concatStringsSep ";" (map (pkg: pkg.passthru.modulePath) modules);
} // extraAttrs)