Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmux-fingers: 2.1.1 -> 2.2.2 #336863

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
davidsierradz marked this conversation as resolved.
Show resolved Hide resolved
};
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";
};
}