Rename t and replace tmux-sessionizer
All checks were successful
/ check (push) Successful in 53s

This commit is contained in:
Oliver Davies 2025-09-03 08:10:13 +01:00
parent b44bbef3e2
commit 21d9ca8737
8 changed files with 4 additions and 112 deletions

View file

@ -1,15 +0,0 @@
{ config, ... }:
{
flake.modules.nixos."nixosConfigurations/t480".home-manager.users.${config.flake.meta.owner.username} = args: {
programs.tmux-sessionizer.searchPaths =
let
inherit (args.config.xdg) userDirs;
in
[
"${userDirs.extraConfig.XDG_REPOS_DIR}:3"
"${userDirs.documents}:1"
"${args.config.home.homeDirectory}/tmp"
];
};
}

View file

@ -25,13 +25,13 @@
user_path="$XDG_REPOS_DIR/$domain/$user"
repo_path="$user_path/$name"
[[ -d "$repo_path" ]] && t "$repo_path" && exit 0
[[ -d "$repo_path" ]] && tmux-sessionizer "$repo_path" && exit 0
mkdir -pv "$repo_path"
git clone "$repo_url" "$repo_path"
t "$repo_path"
tmux-sessionizer "$repo_path"
else
exit 1
fi

View file

@ -4,9 +4,9 @@
{
home.packages = [
(pkgs.writeShellApplication {
name = "t";
name = "tmux-sessionizer";
runtimeInputs = with pkgs; [ fzf ];
runtimeInputs = with pkgs; [ coreutils fzf tmux ];
text = ''
set -euo pipefail

View file

@ -1,26 +0,0 @@
{ lib, ... }:
{
flake.modules.homeManager.base =
{ config, ... }:
{
options.programs.tmux-sessionizer = {
searchPaths = lib.mkOption {
default = [ config.home.homeDirectory ];
type = lib.types.listOf lib.types.str;
description = "List of search paths for tmux-sessionizer to use.";
};
# TODO: add TS_EXTRA_SEARCH_PATHS.
# TODO: add TS_MAX_DEPTH.
# TODO: add TS_SESSION_COMMANDS once I figure out what they're for.
};
config = {
xdg.configFile."tmux-sessionizer/tmux-sessionizer.conf".text = ''
TS_SEARCH_PATHS=(${builtins.concatStringsSep " " config.programs.tmux-sessionizer.searchPaths})
TS_SESSION_COMMANDS=(nvim .)
'';
};
};
}

View file

@ -1,7 +0,0 @@
{
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = with pkgs; [ tmux-sessionizer ];
};
}

View file

@ -1,37 +0,0 @@
{ pkgs, ... }:
with pkgs;
stdenv.mkDerivation {
pname = "tmux-sessionizer";
version = "unstable-2025-06-19";
src = fetchFromGitHub {
owner = "theprimeagen";
repo = "tmux-sessionizer";
rev = "7edf8211e36368c29ffc0d2c6d5d2d350b4d729b";
sha256 = "sha256-4QGlq/cLbed7AZhQ3R1yH+44gmgp9gSzbiQft8X5NwU=";
};
buildInputs = [
bash
fzf
tmux
];
installPhase = ''
mkdir -p $out/bin
cp tmux-sessionizer $out/bin/tmux-sessionizer
chmod +x $out/bin/tmux-sessionizer
'';
patches = [
(fetchpatch {
name = "Sort directories alphabetically #23";
sha256 = "sha256-AtaOlV2JSeR0BmDsfuv8ZFbu5G0vz4RdUPY4ZF4UqQc=";
url = "https://patch-diff.githubusercontent.com/raw/ThePrimeagen/tmux-sessionizer/pull/23.patch";
})
./shorten-paths.patch
];
}

View file

@ -1,23 +0,0 @@
diff --git a/tmux-sessionizer b/tmux-sessionizer
index 036d2a3..cd11500 100755
--- a/tmux-sessionizer
+++ b/tmux-sessionizer
@@ -252,7 +252,7 @@ find_dirs() {
if [[ -d "$path" ]]; then
while IFS= read -r dir; do
dir_list+=("$dir")
- done < <(find "$path" -mindepth 1 -maxdepth "$depth" -path '*/.git' -prune -o -type d -print)
+ done < <(find "$path" -mindepth 1 -maxdepth "$depth" -path '*/.git' -prune -o -type d -print | sed "s#$HOME/##" )
fi
done
@@ -341,6 +341,9 @@ fi
if [[ "$selected" =~ ^\[TMUX\]\ (.+)$ ]]; then
selected="${BASH_REMATCH[1]}"
+else
+ # Re-add the Home directory back to the selected path.
+ selected="$HOME/$selected"
fi
selected_name=$(basename "$selected" | tr . _)