mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 04:46:43 +00:00
30d581b29d
the bash script will retrieve the $var and cause the variable expand to empty add \ to prevent this, and let fish command to retrieve the variable
26 lines
762 B
Nix
26 lines
762 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;
|
|
|
|
in writeShellScriptBin "fish" ''
|
|
${fish}/bin/fish --init-command "
|
|
set --prepend fish_complete_path ${escapeShellArgs complPath}
|
|
set --prepend fish_function_path ${escapeShellArgs funcPath}
|
|
set --local fish_conf_source_path ${escapeShellArgs confPath}
|
|
for c in \$fish_conf_source_path/*; source \$c; end
|
|
" "$@"
|
|
'')
|