Files
home-manager/tests/modules/programs/fzf/bash-widget-overrides.nix
Austin Horstman a4d410db95 fzf: group related module attributes
Group repeated attr prefixes so the fzf module and new tests are easier to scan without changing behavior.
2026-07-02 15:28:15 -05:00

48 lines
1.1 KiB
Nix

{ config, ... }:
{
programs = {
fzf = {
enable = true;
enableBashIntegration = true;
historyWidget = {
command = "global-history";
bash.command = "";
};
fileWidget.bash.command = "$HOME/bin/files";
package = config.lib.test.mkStubPackage {
name = "fzf";
version = "0.73.0";
buildScript = ''
mkdir -p $out/bin
cat > $out/bin/fzf <<'EOF'
#!/bin/sh
echo "Stub fzf"
EOF
chmod +x $out/bin/fzf
'';
};
};
bash.enable = true;
};
nmt.script = ''
assertFileRegex home-files/.bashrc \
'export FZF_CTRL_R_COMMAND='
assertFileContains home-files/.bashrc \
'export FZF_CTRL_T_COMMAND="$HOME/bin/files"'
overrideLine=$(grep -n 'export FZF_CTRL_R_COMMAND=' "$TESTED/home-files/.bashrc" | head -n1 | cut -d: -f1)
sourceLine=$(grep -n 'fzf.*--bash' "$TESTED/home-files/.bashrc" | head -n1 | cut -d: -f1)
if [[ -z "$overrideLine" || -z "$sourceLine" || "$overrideLine" -ge "$sourceLine" ]]; then
fail "bash fzf widget override must appear before fzf initialization"
fi
'';
}