Skip to content

Commit

Permalink
tmux-fingers: 2.1.1 -> 2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsierradz committed Sep 9, 2024
1 parent 344e301 commit 892012a
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 23 deletions.
25 changes: 2 additions & 23 deletions pkgs/misc/tmux-plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
46 changes: 46 additions & 0 deletions pkgs/misc/tmux-plugins/tmux-fingers/default.nix
Original file line number Diff line number Diff line change
@@ -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";
})
];
}
41 changes: 41 additions & 0 deletions pkgs/misc/tmux-plugins/tmux-fingers/fix.patch
Original file line number Diff line number Diff line change
@@ -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 $?
12 changes: 12 additions & 0 deletions pkgs/misc/tmux-plugins/tmux-fingers/shards.nix
Original file line number Diff line number Diff line change
@@ -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";
};
}

0 comments on commit 892012a

Please sign in to comment.