fzf: source nushell integration after carapace

This commit is contained in:
Vinicius Deolindo 2026-06-25 17:55:32 -03:00 committed by Austin Horstman
parent 19d7472aca
commit 5d320ab301
2 changed files with 27 additions and 3 deletions

View file

@ -8,6 +8,7 @@ let
inherit (lib)
getExe
literalExpression
mkAfter
mkIf
mkOption
mkOrder
@ -230,8 +231,11 @@ in
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration (mkOrder 200 fishIntegration);
# Initialize after other completion integrations, such as carapace.
# fzf preserves the previous external completer and falls back to it
# when its own completer does not apply.
programs.nushell = lib.mkIf cfg.enableNushellIntegration {
extraConfig = ''
extraConfig = mkAfter ''
source ${
pkgs.runCommand "nushell-fzf-integration.nu" { } ''
${lib.getExe cfg.package} --nushell > $out

View file

@ -1,6 +1,22 @@
{ config, pkgs, ... }:
{
programs.carapace = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "carapace";
buildScript = ''
mkdir -p $out/bin
cat > $out/bin/carapace << 'EOF'
#!/bin/sh
echo "Stub carapace"
EOF
chmod +x $out/bin/carapace
'';
};
};
programs.fzf = {
enable = true;
enableNushellIntegration = true;
@ -31,7 +47,11 @@
in
''
assertFileExists "${nushellConfigFile}"
assertFileRegex "${nushellConfigFile}" \
'source.*nushell-fzf-integration'
assertFileContent "$(normalizeStorePaths "${nushellConfigFile}")" ${builtins.toFile "nushell-fzf-integration-expected.nu" ''
source /nix/store/00000000000000000000000000000000-carapace-nushell-config.nu
source /nix/store/00000000000000000000000000000000-nushell-fzf-integration.nu
''}
'';
}