fish-foreign-env: move to fishPlugins.foreign-env

And relocate the installed fish functions to the `vendor_functions.d` so
that they're automatically loaded.
This commit is contained in:
pacien
2020-12-29 09:44:18 +01:00
parent 59c1b6d0e7
commit d94921db12
7 changed files with 23 additions and 16 deletions

View File

@@ -6,6 +6,8 @@ lib.makeScope newScope (self: with self; {
fishtape = callPackage ./fishtape.nix { };
foreign-env = callPackage ./foreign-env { };
pure = callPackage ./pure.nix { };
})

View File

@@ -0,0 +1,29 @@
{ lib, buildFishPlugin, fetchFromGitHub, gnused, bash, coreutils }:
buildFishPlugin {
pname = "foreign-env";
version = "git-20200209";
src = fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
};
patches = [ ./suppress-harmless-warnings.patch ];
preInstall = ''
sed -e "s|sed|${gnused}/bin/sed|" \
-e "s|bash|${bash}/bin/bash|" \
-e "s|\| tr|\| ${coreutils}/bin/tr|" \
-i functions/*
'';
meta = with lib; {
description = "A foreign environment interface for Fish shell";
license = licenses.mit;
maintainers = with maintainers; [ jgillich ];
platforms = with platforms; unix;
};
}

View File

@@ -0,0 +1,23 @@
diff --git a/functions/fenv.apply.fish b/functions/fenv.apply.fish
index 34a25e3..3d94135 100644
--- a/functions/fenv.apply.fish
+++ b/functions/fenv.apply.fish
@@ -27,11 +27,17 @@ function fenv.apply
for variable in $variables
set key (echo $variable | sed 's/=.*//')
set value (echo $variable | sed 's/[^=]*=//')
+ set ignore PATH _
if test "$key" = 'PATH'
set value (echo $value | tr ':' '\n')
end
- set -g -x $key $value
+ if contains $key $ignore
+ set -g -x $key $value 2>/dev/null
+ else
+ set -g -x $key $value
+ end
+
end
end