From 066ab5b5e2c311f95bd019ed1b05bf61684a7602 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Wed, 7 Feb 2024 14:26:33 +1300 Subject: [PATCH] Add setup hook to setup ZEPHYR_SDK_INSTALL_DIR --- README.md | 10 +++++----- default.nix | 12 ++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fe49084..02076cd 100644 --- a/README.md +++ b/README.md @@ -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" - ]; - }; } ``` diff --git a/default.nix b/default.nix index 7db89c5..790a128 100644 --- a/default.nix +++ b/default.nix @@ -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 <> $out/nix-support/setup-hook + export ZEPHYR_SDK_INSTALL_DIR=$out + EOF runHook postInstall '';