a5adf1ddd8
GitOrigin-RevId: b3616bd96400ce0252c241d76fcafb64389defc6
25 lines
756 B
Nix
25 lines
756 B
Nix
{ lib, writeShellScriptBin, fish }:
|
|
|
|
with lib;
|
|
|
|
makeOverridable ({
|
|
completionDirs ? [],
|
|
functionDirs ? [],
|
|
confDirs ? [],
|
|
pluginPkgs ? []
|
|
}:
|
|
|
|
let
|
|
vendorDir = kind: plugin: "${plugin}/share/fish/vendor_${kind}.d";
|
|
complPath = completionDirs ++ map (vendorDir "completions") pluginPkgs;
|
|
funcPath = functionDirs ++ map (vendorDir "functions") pluginPkgs;
|
|
confPath = confDirs ++ map (vendorDir "conf") pluginPkgs;
|
|
safeConfPath = map escapeShellArg confPath;
|
|
|
|
in writeShellScriptBin "fish" ''
|
|
${fish}/bin/fish --init-command "
|
|
set --prepend fish_complete_path ${escapeShellArgs complPath}
|
|
set --prepend fish_function_path ${escapeShellArgs funcPath}
|
|
for c in {${concatStringsSep "," safeConfPath}}/*; source $c; end
|
|
" "$@"
|
|
'')
|