diff --git a/pkgs/misc/tmux-plugins/default.nix b/pkgs/misc/tmux-plugins/default.nix index 8c39ab3f207..7de74f405b4 100644 --- a/pkgs/misc/tmux-plugins/default.nix +++ b/pkgs/misc/tmux-plugins/default.nix @@ -556,6 +556,10 @@ in rec { }; }; + tmux-thumbs = pkgs.callPackage ./tmux-thumbs { + inherit mkTmuxPlugin; + }; + urlview = mkTmuxPlugin { pluginName = "urlview"; version = "unstable-2016-01-06"; diff --git a/pkgs/misc/tmux-plugins/tmux-thumbs/default.nix b/pkgs/misc/tmux-plugins/tmux-thumbs/default.nix new file mode 100644 index 00000000000..f55a2dbe7b6 --- /dev/null +++ b/pkgs/misc/tmux-plugins/tmux-thumbs/default.nix @@ -0,0 +1,29 @@ +{ lib, mkTmuxPlugin, fetchFromGitHub, thumbs, substituteAll }: + +mkTmuxPlugin rec { + pluginName = "tmux-thumbs"; + version = "0.7.1"; + rtpFilePath = "tmux-thumbs.tmux"; + + src = fetchFromGitHub { + owner = "fcsonline"; + repo = pluginName; + rev = version; + sha256 = "sha256-PH1nscmVhxJFupS7dlbOb+qEwG/Pa/2P6XFIbR/cfaQ="; + }; + + patches = [ + (substituteAll { + src = ./fix.patch; + tmuxThumbsDir = "${thumbs}/bin"; + }) + ]; + + meta = with lib; { + homepage = "https://github.com/fcsonline/tmux-thumbs"; + description = "A lightning fast version of tmux-fingers written in Rust for copy pasting with vimium/vimperator like hints."; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ ghostbuster91 ]; + }; +} diff --git a/pkgs/misc/tmux-plugins/tmux-thumbs/fix.patch b/pkgs/misc/tmux-plugins/tmux-thumbs/fix.patch new file mode 100644 index 00000000000..326696ebc40 --- /dev/null +++ b/pkgs/misc/tmux-plugins/tmux-thumbs/fix.patch @@ -0,0 +1,45 @@ +diff --git a/tmux-thumbs.sh b/tmux-thumbs.sh +index 34dd528..8c05d54 100755 +--- a/tmux-thumbs.sh ++++ b/tmux-thumbs.sh +@@ -1,22 +1,8 @@ + #!/usr/bin/env bash + set -Eeu -o pipefail + +-VERSION=$(grep 'version =' Cargo.toml | grep -oe "[0-9]\+.[0-9]\+.[0-9]\+") +- + # Setup env variables to be compatible with compiled and bundled installations + CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +-RELEASE_DIR="${CURRENT_DIR}/target/release" +- +-THUMBS_BINARY="${RELEASE_DIR}/thumbs" +-TMUX_THUMBS_BINARY="${RELEASE_DIR}/tmux-thumbs" +- +-if [ ! -f "$THUMBS_BINARY" ]; then +- tmux split-window "cd ${CURRENT_DIR} && bash ./tmux-thumbs-install.sh" +- exit +-elif [[ $(${THUMBS_BINARY} --version) != "thumbs ${VERSION}" ]]; then +- tmux split-window "cd ${CURRENT_DIR} && bash ./tmux-thumbs-install.sh update" +- exit +-fi + + function get-opt-value() { + tmux show -vg "@thumbs-${1}" 2> /dev/null +@@ -36,7 +22,7 @@ function get-opt-arg() { + fi + } + +-PARAMS=(--dir "${CURRENT_DIR}") ++PARAMS=(--dir @tmuxThumbsDir@) + + function add-param() { + local type opt arg +@@ -51,4 +37,4 @@ add-param upcase-command string + add-param multi-command string + add-param osc52 boolean + +-"${TMUX_THUMBS_BINARY}" "${PARAMS[@]}" || true ++@tmuxThumbsDir@/tmux-thumbs "${PARAMS[@]}" || true + + +