From e46d0c5f523dc51527c29ff1a950ea170f7d408f Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Sun, 27 Feb 2022 21:46:17 +0100 Subject: [PATCH 1/3] maintainers: add ghostbuster91 --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 7cae29a1eefe..8bb7a91a45cd 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -4502,6 +4502,12 @@ githubId = 3217744; name = "Peter Ferenczy"; }; + ghostbuster91 = { + name = "Kasper Kondzielski"; + email = "kghost0@gmail.com"; + github = "ghostbuster91"; + githubId = 5662622; + }; ghuntley = { email = "ghuntley@ghuntley.com"; github = "ghuntley"; From 3dc0287de026a5fc157839af35cb459760eb136f Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Sun, 27 Feb 2022 21:34:45 +0100 Subject: [PATCH 2/3] thumbs: init at 0.7.1 --- pkgs/tools/misc/thumbs/default.nix | 23 +++++++++++++++++++++++ pkgs/tools/misc/thumbs/fix.patch | 13 +++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 38 insertions(+) create mode 100644 pkgs/tools/misc/thumbs/default.nix create mode 100644 pkgs/tools/misc/thumbs/fix.patch diff --git a/pkgs/tools/misc/thumbs/default.nix b/pkgs/tools/misc/thumbs/default.nix new file mode 100644 index 000000000000..60a1dce08c08 --- /dev/null +++ b/pkgs/tools/misc/thumbs/default.nix @@ -0,0 +1,23 @@ +{ lib, rustPlatform, fetchFromGitHub }: + +rustPlatform.buildRustPackage rec { + pname = "thumbs"; + version = "0.7.1"; + + src = fetchFromGitHub { + owner = "fcsonline"; + repo = "tmux-thumbs"; + rev = version; + sha256 = "sha256-PH1nscmVhxJFupS7dlbOb+qEwG/Pa/2P6XFIbR/cfaQ="; + }; + + cargoSha256 = "sha256-6htKiXMMyYRFefJzvDnmdx3CJ3XL8zONhGlV2wcbr9g="; + + cargoPatches = [ ./fix.patch ]; + meta = with lib; { + homepage = "https://github.com/fcsonline/tmux-thumbs"; + description = "A lightning fast version copy/pasting like vimium/vimperator"; + license = licenses.mit; + maintainers = with maintainers; [ ghostbuster91 ]; + }; +} diff --git a/pkgs/tools/misc/thumbs/fix.patch b/pkgs/tools/misc/thumbs/fix.patch new file mode 100644 index 000000000000..e04d7db8598a --- /dev/null +++ b/pkgs/tools/misc/thumbs/fix.patch @@ -0,0 +1,13 @@ +diff --git a/src/swapper.rs b/src/swapper.rs +index 6cf1e89..bcb0969 100644 +--- a/src/swapper.rs ++++ b/src/swapper.rs +@@ -215,7 +215,7 @@ impl<'a> Swapper<'a> { + }; + + let pane_command = format!( +- "tmux capture-pane -t {active_pane_id} -p{scroll_params} | tail -n {height} | {dir}/target/release/thumbs -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}", ++ "tmux capture-pane -t {active_pane_id} -p{scroll_params} | tail -n {height} | {dir}/thumbs -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}", + active_pane_id = active_pane_id, + scroll_params = scroll_params, + height = self.active_pane_height.unwrap_or(i32::MAX), diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 60ae4faa4391..2a4e968f4122 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1137,6 +1137,8 @@ with pkgs; tfk8s = callPackage ../tools/misc/tfk8s { }; + thumbs = callPackage ../tools/misc/thumbs { }; + tnat64 = callPackage ../tools/networking/tnat64 { }; topicctl = callPackage ../tools/misc/topicctl { }; From 23554630946fbc7b81106e1202ab996483d6d567 Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Sun, 27 Feb 2022 21:35:39 +0100 Subject: [PATCH 3/3] tmux-thumbs: init at 0.7.1 --- pkgs/misc/tmux-plugins/default.nix | 4 ++ .../misc/tmux-plugins/tmux-thumbs/default.nix | 29 ++++++++++++ pkgs/misc/tmux-plugins/tmux-thumbs/fix.patch | 45 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 pkgs/misc/tmux-plugins/tmux-thumbs/default.nix create mode 100644 pkgs/misc/tmux-plugins/tmux-thumbs/fix.patch diff --git a/pkgs/misc/tmux-plugins/default.nix b/pkgs/misc/tmux-plugins/default.nix index 8c39ab3f207f..7de74f405b41 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 000000000000..f55a2dbe7b60 --- /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 000000000000..326696ebc40a --- /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 + + +