Add cd-fzf

This commit is contained in:
Dave Gallant
2025-01-27 20:14:33 -05:00
parent 755ba0ca57
commit 266401ceec
5 changed files with 36 additions and 1 deletions

17
overlays/cd-fzf/cd-fzf Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
readarray -t directories < ~/.config/cd-fzf
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find "${directories[@]}" -mindepth 1 -maxdepth 1 -type d | fzf --exact)
fi
if [[ -z $selected ]]; then
exit 0
fi
cd "$selected"
$SHELL

View File

@@ -0,0 +1,16 @@
{ stdenv, lib, fetchurl, }:
stdenv.mkDerivation rec {
pname = "cd-fzf";
version = "0.0.1";
executable = ./cd-fzf;
phases = [ "unpackPhase" ]; # Remove all other phases
unpackPhase = ''
mkdir -p $out/bin
cp ${executable} $out/bin/cd-fzf
'';
meta = with lib; {
description =
"\n Fuzzy find change directory";
platforms = platforms.unix;
};
}

View File

@@ -1,4 +1,5 @@
final: prev: {
cd-fzf = prev.callPackage ./cd-fzf { };
sbx-h6-rgb = prev.callPackage ./sbx-h6-rgb { };
vpngate = prev.callPackage ./vpngate { };
}