From 648a3db9343755a3d380c3247bc0bb2f3b4c5b30 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 5 Jan 2021 17:30:52 +0100 Subject: fishPlugins.buildFishPlugin: use wrapFish --- pkgs/shells/fish/plugins/build-fish-plugin.nix | 34 +++++++++----------------- pkgs/shells/fish/plugins/pure.nix | 2 +- 2 files changed, 13 insertions(+), 23 deletions(-) (limited to 'pkgs/shells/fish') diff --git a/pkgs/shells/fish/plugins/build-fish-plugin.nix b/pkgs/shells/fish/plugins/build-fish-plugin.nix index e2ec342e5440..98e0912a33c6 100644 --- a/pkgs/shells/fish/plugins/build-fish-plugin.nix +++ b/pkgs/shells/fish/plugins/build-fish-plugin.nix @@ -1,23 +1,6 @@ -{ stdenv, lib, writeShellScriptBin, writeScript, fish }: +{ stdenv, lib, writeScript, wrapFish }: -let - 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@{ +attrs@{ pname, version, src, @@ -32,7 +15,9 @@ in attrs@{ installPath ? lib.getName pname, 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 ? [], # test script to be executed in a fish shell checkPhase ? "", @@ -52,7 +37,7 @@ stdenv.mkDerivation (attrs // { ( install_vendor_files() { source="$1" - target="$out/${rtpPath}/vendor_$2.d" + target="$out/share/fish/vendor_$2.d" [ -d $source ] || return 0 mkdir -p $target @@ -69,7 +54,12 @@ stdenv.mkDerivation (attrs // { ''; inherit doCheck; - checkInputs = [ (fishWithFunctionPath checkFunctionPath) ] ++ checkInputs; + + checkInputs = [ (wrapFish { + pluginPkgs = checkPlugins; + functionDirs = checkFunctionPath; + }) ] ++ checkInputs; + checkPhase = '' export HOME=$(mktemp -d) # fish wants a writable home fish "${writeScript "${name}-test" checkPhase}" diff --git a/pkgs/shells/fish/plugins/pure.nix b/pkgs/shells/fish/plugins/pure.nix index 54af2e0663e8..3221f6b97ca7 100644 --- a/pkgs/shells/fish/plugins/pure.nix +++ b/pkgs/shells/fish/plugins/pure.nix @@ -12,7 +12,7 @@ buildFishPlugin rec { }; checkInputs = [ git ]; - checkFunctionPath = [ fishtape ]; + checkPlugins = [ fishtape ]; checkPhase = '' # https://github.com/rafaelrinaldi/pure/issues/264 rm tests/_pure_string_width.test.fish -- cgit 1.4.1