From fbdd609c0df33f23951293915b17f81ba2516742 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 3 Dec 2023 18:20:06 +0100 Subject: [PATCH] Correct shell usage example --- README.md | 10 +++++++++- arduino-env.nix | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1373ed9..d69518d 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,12 @@ From the indexes you create overlays which then make the Arduino packages and li src = ./. + "/my-esp32-poe-iso-project"; fqbn = "esp32:esp32:esp32-poe-iso"; }; + }; + + hydraJobs = { + # Build binary tarball in CI + my-esp32-poe-iso-project = my-esp32-poe-iso-project.binaryTarball; + }; } )); } @@ -108,9 +114,11 @@ From the indexes you create overlays which then make the Arduino packages and li ## Interactive arduino-cli usage: ``` -nix develop .#arduinoEnv +nix shell .#arduinoEnv ``` +This adds a wrapped version of `arduino-cli` to your path that reflects you Arduino environment. + ## Build Arduino Sketch ``` diff --git a/arduino-env.nix b/arduino-env.nix index 4a6117a..71a1bb2 100644 --- a/arduino-env.nix +++ b/arduino-env.nix @@ -49,6 +49,10 @@ let inherit fqbn; arduinoSketch = (finalAttrs.finalPackage); }; + binaryTarball = binaryTarball { + inherit name; + arduinoSketch = (finalAttrs.finalPackage); + }; }; }); @@ -58,5 +62,18 @@ let }: pkgs.writeScriptBin "upload-arduino-sketch" '' ${arduinoEnv}/bin/arduino-cli upload --log --input-dir=${arduinoSketch} --fqbn=${fqbn} "$@" ''; + + binaryTarball = { + arduinoSketch + , name + }: pkgs.runCommand "binary-tarball" {} '' + mkdir -p $out + + cd ${arduinoSketch} + ${pkgs.gnutar}/bin/tar -czf $out/${name}.tar.gz * + + mkdir -p $out/nix-support + echo "file binary-dist $out/${name}.tar.gz" > $out/nix-support/hydra-build-products + ''; in mkArduinoEnv