fzf: export environment variables to nushell

Pure Nushell sessions do not source hm-session-vars, so feed the same FZF_* values through programs.nushell.environmentVariables before sourcing fzf integration.
This commit is contained in:
Austin Horstman
2026-07-02 15:28:15 -05:00
parent fe3ce0a527
commit 2d92f5398d
3 changed files with 48 additions and 0 deletions
+2
View File
@@ -273,6 +273,8 @@ in
# fzf preserves the previous external completer and falls back to it
# when its own completer does not apply.
programs.nushell = lib.mkIf cfg.enableNushellIntegration {
environmentVariables = lib.mapAttrs (_n: toString) fzfEnvVars;
extraConfig = mkAfter ''
source ${
pkgs.runCommand "nushell-fzf-integration.nu" { } ''
+1
View File
@@ -6,5 +6,6 @@
fzf-fish-integration = ./fish-integration.nix;
fzf-history-command-version-warning = ./history-command-version-warning.nix;
fzf-nushell-integration = ./nushell-integration.nix;
fzf-nushell-history-command = ./nushell-history-command.nix;
fzf-renamed-options = ./renamed-options.nix;
}
@@ -0,0 +1,45 @@
{ config, pkgs, ... }:
{
programs.fzf = {
enable = true;
enableNushellIntegration = true;
historyWidget.command = "";
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
'';
};
};
programs.nushell.enable = true;
nmt.script =
let
nushellConfigFile =
if pkgs.stdenv.isDarwin && !config.xdg.enable then
"home-files/Library/Application Support/nushell/config.nu"
else
"home-files/.config/nushell/config.nu";
in
''
assertFileExists "${nushellConfigFile}"
assertFileContent "$(normalizeStorePaths "${nushellConfigFile}")" ${builtins.toFile "nushell-fzf-history-command-expected.nu" ''
load-env {
"FZF_CTRL_R_COMMAND": ""
}
source /nix/store/00000000000000000000000000000000-nushell-fzf-integration.nu
''}
'';
}