diff --git a/default.nix b/default.nix index ec582ee..a720ea9 100644 --- a/default.nix +++ b/default.nix @@ -4,5 +4,33 @@ in with import { overlays = [ mozillaOverlay ]; }; let rustPlatform = recurseIntoAttrs (callPackage (import ./nix/rustPlatform.nix) {}); + adc2tcp = callPackage (import ./nix/adc2tcp.nix) { inherit rustPlatform; }; + openocd = callPackage (import ./nix/openocd.nix) {}; in -callPackage (import ./nix/adc2tcp.nix) { inherit rustPlatform; } +stdenv.mkDerivation { + name = "adc2tcp-dist"; + buildInputs = [ + adc2tcp + openocd + gdb + ]; + src = ./.; + dontBuild = true; + + installPhase = '' + mkdir -p $out/bin $out/lib + + BIN=$out/lib/adc2tcp + ln -s ${adc2tcp}/lib/adc2tcp $BIN + cat >> $out/bin/flash-adc2tcp <> $out/bin/openocd-nucleo-f429zi < { overlays = [ mozillaOverlay ]; }; let - rustPlatform = recurseIntoAttrs ( - callPackage (import ./nix/rustPlatform.nix) { inherit rustChannel; } - ); + rustPlatform = callPackage (import ./nix/rustPlatform.nix) { inherit rustChannel; }; + openocd = callPackage (import ./nix/openocd.nix) {}; in -# mkShell { -# inputsFrom = with rustPlatform.rust; [ -# rustc cargo -# ]; -# } stdenv.mkDerivation { name = "adc2tcp-env"; buildInputs = with rustPlatform.rust; [ @@ -22,4 +16,15 @@ stdenv.mkDerivation { # Set Environment Variables RUST_BACKTRACE = 1; + + shellHook = '' + echo "Starting openocd…" + ${openocd}/bin/openocd-nucleo-f429zi & + + # Let openocd output scroll by + sleep 1 + + echo "Run 'cargo build --release'" + echo "Then 'gdb target/thumbv7em-none-eabihf/release/adc2tcp'" + ''; }