From c9c7974117d15ba5e550cb1d3caf54f774f41065 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Tue, 3 Sep 2024 18:51:42 -0500 Subject: [PATCH] tmux-fingers: 2.1.1 -> 2.2.2 --- pkgs/misc/tmux-plugins/default.nix | 25 +--------- .../tmux-plugins/tmux-fingers/default.nix | 46 +++++++++++++++++++ pkgs/misc/tmux-plugins/tmux-fingers/fix.patch | 41 +++++++++++++++++ .../misc/tmux-plugins/tmux-fingers/shards.nix | 12 +++++ 4 files changed, 101 insertions(+), 23 deletions(-) create mode 100644 pkgs/misc/tmux-plugins/tmux-fingers/default.nix create mode 100644 pkgs/misc/tmux-plugins/tmux-fingers/fix.patch create mode 100644 pkgs/misc/tmux-plugins/tmux-fingers/shards.nix diff --git a/pkgs/misc/tmux-plugins/default.nix b/pkgs/misc/tmux-plugins/default.nix index 7af81347e8e2..dacf6ba1ef6f 100644 --- a/pkgs/misc/tmux-plugins/default.nix +++ b/pkgs/misc/tmux-plugins/default.nix @@ -242,29 +242,8 @@ in rec { }; }; - fingers = mkTmuxPlugin rec { - pluginName = "tmux-fingers"; - rtpFilePath = "load-config.tmux"; - version = "2.1.1"; - src = fetchFromGitHub { - owner = "Morantron"; - repo = "tmux-fingers"; - rev = "${version}"; - sha256 = "sha256-1YMh6m8M6FKf8RPXsOfWCVC5CXSr/MynguwkG7O+oEY="; - }; - nativeBuildInputs = [ pkgs.makeWrapper pkgs.crystal pkgs.shards ]; - postInstall = '' - shards build --production - rm -rf $target/* $target/.* - cp -r bin $target/bin - echo "$target/bin/${pluginName} load-config" > $target/${rtpFilePath} - chmod +x $target/${rtpFilePath} - - wrapProgram $target/${rtpFilePath} \ - --prefix PATH : ${with pkgs; lib.makeBinPath ( - [ gawk ] ++ lib.optionals stdenv.isDarwin [ reattach-to-user-namespace ] - )} - ''; + fingers = pkgs.callPackage ./tmux-fingers { + inherit mkTmuxPlugin; }; fpp = mkTmuxPlugin { diff --git a/pkgs/misc/tmux-plugins/tmux-fingers/default.nix b/pkgs/misc/tmux-plugins/tmux-fingers/default.nix new file mode 100644 index 000000000000..bb415d76935b --- /dev/null +++ b/pkgs/misc/tmux-plugins/tmux-fingers/default.nix @@ -0,0 +1,46 @@ +{ + mkTmuxPlugin, + substituteAll, + fetchFromGitHub, + crystal, +}: +let + fingers = crystal.buildCrystalPackage rec { + format = "shards"; + version = "2.2.2"; + pname = "fingers"; + src = fetchFromGitHub { + owner = "Morantron"; + repo = "tmux-fingers"; + rev = "${version}"; + sha256 = "sha256-m9QON7diHVEDnnv/alXCJOG+BnfrAKygScrubZZ605I="; + }; + + shardsFile = ./shards.nix; + crystalBinaries.tmux-fingers.src = "src/fingers.cr"; + + postInstall = '' + shopt -s dotglob extglob + rm -rv !("tmux-fingers.tmux"|"bin") + shopt -u dotglob extglob + ''; + + # TODO: Needs starting a TMUX session to run tests + # Unhandled exception: Missing ENV key: "TMUX" (KeyError) + doCheck = false; + doInstallCheck = false; + }; +in +mkTmuxPlugin { + inherit (fingers) version src meta; + + pluginName = fingers.src.repo; + rtpFilePath = "tmux-fingers.tmux"; + + patches = [ + (substituteAll { + src = ./fix.patch; + tmuxFingersDir = "${fingers}/bin"; + }) + ]; +} diff --git a/pkgs/misc/tmux-plugins/tmux-fingers/fix.patch b/pkgs/misc/tmux-plugins/tmux-fingers/fix.patch new file mode 100644 index 000000000000..34014441ebf9 --- /dev/null +++ b/pkgs/misc/tmux-plugins/tmux-fingers/fix.patch @@ -0,0 +1,41 @@ +diff --git a/tmux-fingers.tmux b/tmux-fingers.tmux +index f15b509..a14e312 100755 +--- a/tmux-fingers.tmux ++++ b/tmux-fingers.tmux +@@ -1,35 +1,4 @@ + #!/usr/bin/env bash + +-CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +- +-if command -v "tmux-fingers" &>/dev/null; then +- FINGERS_BINARY="tmux-fingers" +-elif [[ -f "$CURRENT_DIR/bin/tmux-fingers" ]]; then +- FINGERS_BINARY="$CURRENT_DIR/bin/tmux-fingers" +-fi +- +-if [[ -z "$FINGERS_BINARY" ]]; then +- tmux run-shell -b "bash $CURRENT_DIR/install-wizard.sh" +- exit 0 +-fi +- +-CURRENT_FINGERS_VERSION="$($FINGERS_BINARY version)" +- +-pushd $CURRENT_DIR &> /dev/null +-CURRENT_GIT_VERSION=$(cat shard.yml | grep "^version" | cut -f2 -d':' | sed "s/ //g") +-popd &> /dev/null +- +-SKIP_WIZARD=$(tmux show-option -gqv @fingers-skip-wizard) +-SKIP_WIZARD=${SKIP_WIZARD:-0} +- +-if [ "$SKIP_WIZARD" = "0" ] && [ "$CURRENT_FINGERS_VERSION" != "$CURRENT_GIT_VERSION" ]; then +- tmux run-shell -b "FINGERS_UPDATE=1 bash $CURRENT_DIR/install-wizard.sh" +- +- if [[ "$?" != "0" ]]; then +- echo "Something went wrong while updating tmux-fingers. Please try again." +- exit 1 +- fi +-fi +- +-tmux run "$FINGERS_BINARY load-config" ++tmux run "@tmuxFingersDir@/tmux-fingers load-config" + exit $? diff --git a/pkgs/misc/tmux-plugins/tmux-fingers/shards.nix b/pkgs/misc/tmux-plugins/tmux-fingers/shards.nix new file mode 100644 index 000000000000..9367ddf7b1a7 --- /dev/null +++ b/pkgs/misc/tmux-plugins/tmux-fingers/shards.nix @@ -0,0 +1,12 @@ +{ + cling = { + url = "https://github.com/devnote-dev/cling.git"; + rev = "v3.0.0"; + sha256 = "0mj5xvpiif1vhg4qds938p9zb5a47qzl397ybz1l1jks0gg361wq"; + }; + xdg_base_directory = { + url = "https://github.com/tijn/xdg_base_directory.git"; + rev = "60bf28dc060c221d5af52727927e92b840022eb0"; + sha256 = "1sa8bw8mzsz0pbj3m8v0w1pnk1q86zjivr0jndfg77wa33ki34y0"; + }; +}