Move Nix files into a nix directory
Move everything from `config` to the root level.
This commit is contained in:
parent
9f47df62b5
commit
69a397e624
124 changed files with 14 additions and 14 deletions
nix/lib/shared/scripts
38
nix/lib/shared/scripts/t.nix
Normal file
38
nix/lib/shared/scripts/t.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ pkgs }:
|
||||
|
||||
{
|
||||
name = "t";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
openssl
|
||||
tmux
|
||||
];
|
||||
|
||||
text = ''
|
||||
# Based on similar scripts by ThePrimeagen and Jess Archer.
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected_path=$1
|
||||
else
|
||||
# Get the session name from fuzzy-finding list of directories and generating a
|
||||
# tmux-safe version.
|
||||
items=$(find "$REPOS" ~/Documents \
|
||||
-maxdepth 1 -mindepth 1 -type d \
|
||||
! -name "_archive" \
|
||||
! -name "*-old" \
|
||||
! -name "*.old"
|
||||
)
|
||||
|
||||
selected_path=$(echo "''${items}" | sort | fzf --reverse)
|
||||
fi
|
||||
|
||||
session_name=$(basename "$selected_path" | sed 's/\./_/g')
|
||||
|
||||
if tmux switch-client -t="$session_name" 2>/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
( (tmux new-session -c "$selected_path" -d -s "$session_name" && tmux switch-client -t "$session_name") 2>/dev/null ) ||
|
||||
tmux new-session -c "$selected_path" -A -s "$session_name"
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue