Add setup hook to setup ZEPHYR_SDK_INSTALL_DIR

This commit is contained in:
adisbladis 2024-02-07 14:26:33 +13:00
parent 4a88b31471
commit 066ab5b5e2
2 changed files with 15 additions and 7 deletions

View File

@ -48,6 +48,11 @@ Develop Zephyr projects using Nix
mkShell {
packages = [
(zephyr.sdk.override {
targets = [
"arm-zephyr-eabi"
];
})
zephyr.pythonEnv
# Use zephyr.hosttools-nix to use nixpkgs built tooling instead of official Zephyr binaries
zephyr.hosttools
@ -55,11 +60,6 @@ mkShell {
ninja
];
env.ZEPHYR_SDK_INSTALL_DIR = zephyr.sdk.override {
targets = [
"arm-zephyr-eabi"
];
};
}
```

View File

@ -77,10 +77,18 @@ rec {
runHook preInstall
rm zephyr-sdk-$version/zephyr-sdk-${arch}-hosttools-standalone-*.sh
rm zephyr-sdk-$version/setup.sh;
rm -f env-vars
mv zephyr-sdk-$version $out
mv $(ls | grep -v env-vars) $out/
if [ -n "$(ls -A .)" ]; then
mv * $out
fi
mkdir -p $out/nix-support
cat <<EOF >> $out/nix-support/setup-hook
export ZEPHYR_SDK_INSTALL_DIR=$out
EOF
runHook postInstall
'';