From ae60a038e10ba151c176c6e3100f5195c33cc476 Mon Sep 17 00:00:00 2001
From: Astro <astro@spaceboyz.net>
Date: Mon, 8 Jul 2019 00:57:52 +0200
Subject: [PATCH] openocd: use card10-scripts

---
 openocd.nix | 15 ++++++++++++---
 shell.nix   |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/openocd.nix b/openocd.nix
index 5ba9e984..dcad7ece 100644
--- a/openocd.nix
+++ b/openocd.nix
@@ -16,16 +16,25 @@ let
       ];
       enableParallelBuilding = true;
     });
+  card10-scripts = stdenv.mkDerivation {
+    name = "card10-scripts";
+    src = ./c/openocd/scripts;
+    dontBuild = true;
+    installPhase = ''
+      mkdir -p $out/share/openocd
+      cp -ar . $out/share/openocd/scripts
+   '';
+  };
 in
   stdenv.mkDerivation {
     name = "openocd-card10";
     src = maxim-openocd;
     phases = [ "unpackPhase" "installPhase" ];
-    buildInputs = [ maxim-openocd makeWrapper ];
+    buildInputs = [ makeWrapper maxim-openocd card10-scripts ];
     installPhase = ''
       mkdir -p $out/bin
       makeWrapper ${maxim-openocd}/bin/openocd $out/bin/openocd-card10 \
-        --add-flags "-f ${maxim-openocd}/share/openocd/scripts/interface/cmsis-dap.cfg" \
-        --add-flags "-f ${maxim-openocd}/share/openocd/scripts/target/max32665.cfg"
+        --add-flags "-f ${card10-scripts}/share/openocd/scripts/interface/cmsis-dap.cfg" \
+        --add-flags "-f ${card10-scripts}/share/openocd/scripts/target/max32665.cfg"
     '';
   }
diff --git a/shell.nix b/shell.nix
index 375e9f08..bbe26cfc 100644
--- a/shell.nix
+++ b/shell.nix
@@ -21,6 +21,6 @@ stdenv.mkDerivation {
     # Let openocd output scroll by
     sleep 1
 
-    echo "Run 'cargo run --release'"
+    echo "Run 'cargo run --release watchapp'"
   '';
 }
-- 
GitLab