fishPlugins.buildFishPlugin: use wrapFish
This commit is contained in:
parent
ae5c662182
commit
648a3db934
|
@ -1,23 +1,6 @@
|
||||||
{ stdenv, lib, writeShellScriptBin, writeScript, fish }:
|
{ stdenv, lib, writeScript, wrapFish }:
|
||||||
|
|
||||||
let
|
attrs@{
|
||||||
rtpPath = "share/fish";
|
|
||||||
|
|
||||||
mapToFuncPath = v:
|
|
||||||
if lib.isString v
|
|
||||||
then v
|
|
||||||
else "${v}/${rtpPath}/vendor_functions.d";
|
|
||||||
|
|
||||||
fishWithFunctionPath = plugins: let
|
|
||||||
funcPaths = map mapToFuncPath plugins;
|
|
||||||
in writeShellScriptBin "fish" ''
|
|
||||||
${fish}/bin/fish \
|
|
||||||
--init-command \
|
|
||||||
"set --prepend fish_function_path ${lib.escapeShellArgs funcPaths}" \
|
|
||||||
"$@"
|
|
||||||
'';
|
|
||||||
|
|
||||||
in attrs@{
|
|
||||||
pname,
|
pname,
|
||||||
version,
|
version,
|
||||||
src,
|
src,
|
||||||
|
@ -32,7 +15,9 @@ in attrs@{
|
||||||
installPath ? lib.getName pname,
|
installPath ? lib.getName pname,
|
||||||
|
|
||||||
checkInputs ? [],
|
checkInputs ? [],
|
||||||
# plugins or paths to add to the function path of the test fish shell
|
# plugin packages to add to the vendor paths of the test fish shell
|
||||||
|
checkPlugins ? [],
|
||||||
|
# vendor directories to add to the function path of the test fish shell
|
||||||
checkFunctionPath ? [],
|
checkFunctionPath ? [],
|
||||||
# test script to be executed in a fish shell
|
# test script to be executed in a fish shell
|
||||||
checkPhase ? "",
|
checkPhase ? "",
|
||||||
|
@ -52,7 +37,7 @@ stdenv.mkDerivation (attrs // {
|
||||||
(
|
(
|
||||||
install_vendor_files() {
|
install_vendor_files() {
|
||||||
source="$1"
|
source="$1"
|
||||||
target="$out/${rtpPath}/vendor_$2.d"
|
target="$out/share/fish/vendor_$2.d"
|
||||||
|
|
||||||
[ -d $source ] || return 0
|
[ -d $source ] || return 0
|
||||||
mkdir -p $target
|
mkdir -p $target
|
||||||
|
@ -69,7 +54,12 @@ stdenv.mkDerivation (attrs // {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
inherit doCheck;
|
inherit doCheck;
|
||||||
checkInputs = [ (fishWithFunctionPath checkFunctionPath) ] ++ checkInputs;
|
|
||||||
|
checkInputs = [ (wrapFish {
|
||||||
|
pluginPkgs = checkPlugins;
|
||||||
|
functionDirs = checkFunctionPath;
|
||||||
|
}) ] ++ checkInputs;
|
||||||
|
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
export HOME=$(mktemp -d) # fish wants a writable home
|
export HOME=$(mktemp -d) # fish wants a writable home
|
||||||
fish "${writeScript "${name}-test" checkPhase}"
|
fish "${writeScript "${name}-test" checkPhase}"
|
||||||
|
|
|
@ -12,7 +12,7 @@ buildFishPlugin rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
checkInputs = [ git ];
|
checkInputs = [ git ];
|
||||||
checkFunctionPath = [ fishtape ];
|
checkPlugins = [ fishtape ];
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
# https://github.com/rafaelrinaldi/pure/issues/264
|
# https://github.com/rafaelrinaldi/pure/issues/264
|
||||||
rm tests/_pure_string_width.test.fish
|
rm tests/_pure_string_width.test.fish
|
||||||
|
|
Loading…
Reference in a new issue