feat: adds back overlays and adds nix-search-fzf stolen from this file: https://github.com/IvarWithoutBones/dotfiles/blob/main/home-manager/modules/zsh.nix#L65

This commit is contained in:
Ahwx 2025-08-12 15:21:06 +02:00
parent 071540b706
commit 16fee58705
4 changed files with 285 additions and 1 deletions

View file

@ -0,0 +1,50 @@
{
createScript,
replaceVars,
gnused,
jq,
fzf,
nix,
coreutils,
bash,
nix-search-fzf,
writeShellScript,
}:
let
previewText = createScript "fzf-preview" ./fzf-preview.sh { };
src = replaceVars ./nix-search-fzf.sh {
previewText = "${previewText}/bin/fzf-preview";
};
in
createScript "nix-search-fzf" src {
dependencies = [
gnused
jq
fzf
nix
coreutils
bash
];
# Enter a 'nix shell' with packages selected by this script
passthru.zsh-shell-widget = writeShellScript "nix-search-fzf-shell-widget" ''
nix-search-fzf-shell-widget() {
setopt localoptions pipefail no_aliases 2> /dev/null
local cmd="$(eval "${nix-search-fzf}/bin/nix-search-fzf -c")"
if [[ -z "$cmd" ]]; then
zle redisplay
return 0
fi
zle push-line
BUFFER="''${cmd}"
zle accept-line
local ret=$?
unset cmd
zle reset-prompt
return $ret
}
'';
meta.description = "a wrapper around 'nix {run,shell,edit}' with autocomplete using fzf";
}