Page MenuHomePhabricator

D5246.id17366.diff
No OneTemporary

D5246.id17366.diff

diff --git a/nix/localstack-down.nix b/nix/localstack-down.nix
new file mode 100644
--- /dev/null
+++ b/nix/localstack-down.nix
@@ -0,0 +1,11 @@
+{ lib
+, writeShellApplication
+}:
+
+# writeShellApplication is a "writer helper" which
+# will create a shellchecked executable shell script located in $out/bin/<name>
+# This shell script will be used to allow for impure+stateful actions
+writeShellApplication {
+ name = "localstack-down";
+ text = builtins.readFile ../scripts/localstack_down.sh;
+}
diff --git a/nix/overlay.nix b/nix/overlay.nix
--- a/nix/overlay.nix
+++ b/nix/overlay.nix
@@ -54,7 +54,10 @@
devShells.default = final.callPackage ./dev-shell.nix { };
devShell = final.devShells.default;
+ localstack-down = prev.callPackage ./localstack-down.nix { };
+
localstack-up = prev.callPackage ./localstack-up.nix { };
+
# Make our version of mariadb the default everywhere
mariadb = prev.mariadb_108;
diff --git a/scripts/localstack_down.sh b/scripts/localstack_down.sh
new file mode 100644
--- /dev/null
+++ b/scripts/localstack_down.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+# Since docker is installed outside of nix, need to ensure that it was
+# installed impurely
+if ! command -v docker > /dev/null; then
+ echo "Please install docker" >&2
+ exit 1
+fi
+
+# The 'localstack status' command will poll foever if you have a newer
+# docker cli, so instead use docker ps + grep to determine running container
+if docker ps | grep localstack &> /dev/null; then
+ echo "Stopping locakstack..." >&2
+ docker stop localstack_main > /dev/null
+else
+ echo "no localstack instance found, skipping..."
+fi

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 7:12 AM (6 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690537
Default Alt Text
D5246.id17366.diff (1 KB)

Event Timeline