Merge pull request #191679 from drupol/fish/update-wrapfish
This commit is contained in:
commit
4af4d2bcb1
1 changed files with 31 additions and 9 deletions
|
@ -1,25 +1,47 @@
|
||||||
{ lib, writeShellScriptBin, fish }:
|
{ lib, writeShellScriptBin, fish, writeTextFile }:
|
||||||
|
|
||||||
with lib;
|
lib.makeOverridable ({
|
||||||
|
|
||||||
makeOverridable ({
|
|
||||||
completionDirs ? [],
|
completionDirs ? [],
|
||||||
functionDirs ? [],
|
functionDirs ? [],
|
||||||
confDirs ? [],
|
confDirs ? [],
|
||||||
pluginPkgs ? []
|
pluginPkgs ? [],
|
||||||
|
localConfig ? "",
|
||||||
|
shellAliases ? {}
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
aliasesStr = builtins.concatStringsSep "\n"
|
||||||
|
(lib.mapAttrsToList (k: v: "alias ${k} ${lib.escapeShellArg v}") shellAliases);
|
||||||
|
|
||||||
|
shellAliasesFishConfig = writeTextFile {
|
||||||
|
name = "wrapfish.aliases.fish";
|
||||||
|
destination = "/share/fish/vendor_conf.d/aliases.fish";
|
||||||
|
text = ''
|
||||||
|
status --is-interactive; and begin
|
||||||
|
# Aliases
|
||||||
|
${aliasesStr}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
localFishConfig = writeTextFile {
|
||||||
|
name = "wrapfish.local.fish";
|
||||||
|
destination = "/share/fish/vendor_conf.d/config.local.fish";
|
||||||
|
text = localConfig;
|
||||||
|
};
|
||||||
|
|
||||||
vendorDir = kind: plugin: "${plugin}/share/fish/vendor_${kind}.d";
|
vendorDir = kind: plugin: "${plugin}/share/fish/vendor_${kind}.d";
|
||||||
complPath = completionDirs ++ map (vendorDir "completions") pluginPkgs;
|
complPath = completionDirs ++ map (vendorDir "completions") pluginPkgs;
|
||||||
funcPath = functionDirs ++ map (vendorDir "functions") pluginPkgs;
|
funcPath = functionDirs ++ map (vendorDir "functions") pluginPkgs;
|
||||||
confPath = confDirs ++ map (vendorDir "conf") pluginPkgs;
|
confPath = confDirs
|
||||||
|
++ (map (vendorDir "conf") pluginPkgs)
|
||||||
|
++ (map (vendorDir "conf") [ localFishConfig shellAliasesFishConfig ]);
|
||||||
|
|
||||||
in writeShellScriptBin "fish" ''
|
in writeShellScriptBin "fish" ''
|
||||||
${fish}/bin/fish --init-command "
|
${fish}/bin/fish --init-command "
|
||||||
set --prepend fish_complete_path ${escapeShellArgs complPath}
|
set --prepend fish_complete_path ${lib.escapeShellArgs complPath}
|
||||||
set --prepend fish_function_path ${escapeShellArgs funcPath}
|
set --prepend fish_function_path ${lib.escapeShellArgs funcPath}
|
||||||
set --local fish_conf_source_path ${escapeShellArgs confPath}
|
set --local fish_conf_source_path ${lib.escapeShellArgs confPath}
|
||||||
for c in \$fish_conf_source_path/*; source \$c; end
|
for c in \$fish_conf_source_path/*; source \$c; end
|
||||||
" "$@"
|
" "$@"
|
||||||
'')
|
'')
|
||||||
|
|
Loading…
Reference in a new issue