From 4e2961062bee7ab3a658625cfa02508be4202de2 Mon Sep 17 00:00:00 2001 From: Buddy Date: Thu, 24 Sep 2026 16:41:55 -0700 Subject: [PATCH] feat: add install script for nkeys Installs the nk CLI from nats-io/nkeys releases. The release zip nests everything under a nkeys-v--/ directory (binary is named nk, not nkeys), so set_link points at that nested path rather than flattening the archive. --- dot_local/bin/executable_install-nkeys | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 dot_local/bin/executable_install-nkeys diff --git a/dot_local/bin/executable_install-nkeys b/dot_local/bin/executable_install-nkeys new file mode 100755 index 0000000..fcf2144 --- /dev/null +++ b/dot_local/bin/executable_install-nkeys @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +APP=nkeys +VERSION=${VERSION:-0.4.16} +DEST=${XDG_DATA_HOME}/apps/releases/${APP} + +main() ( + ARCHIVE_DIR=nkeys-v${VERSION}-$(get_os)-$(get_arch) + URL=https://github.com/nats-io/nkeys/releases/download/v${VERSION}/${ARCHIVE_DIR}.zip + + extract_zip "${URL}" "${DEST}/${VERSION}" + set_current_link "${DEST}" "${VERSION}" + set_link "${XDG_BIN_HOME}/nk" "${DEST}" "${ARCHIVE_DIR}/nk" +) + +get_arch () ( + case $(uname -m) in + x86_64*) echo amd64 ;; + arm64*) echo arm64 ;; + aarch64*) echo arm64 ;; + *) >&2 echo "unsupported uname: $(uname -m)"; exit 1 ;; + esac +) + +get_os () ( + case $(uname -s) in + Linux*) echo linux ;; + Darwin*) echo darwin ;; + *) >&2 echo "unsupported os: $(uname -s)"; exit 1 ;; + esac +) + +main "${@}"