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

@ -309,6 +309,14 @@
Based on <xref linkend="opt-system.stateVersion" />, existing installations will continue to work. Based on <xref linkend="opt-system.stateVersion" />, existing installations will continue to work.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
<package>fish-foreign-env</package> is now an alias for the
<package>fishPlugins.foreign-env</package> package, in which the fish
functions have been relocated to the
<literal>vendor_functions.d</literal> directory to be loaded automatically.
</para>
</listitem>
<listitem> <listitem>
<para> <para>
The prometheus json exporter is now managed by the prometheus community. Together with additional features The prometheus json exporter is now managed by the prometheus community. Together with additional features

View File

@ -112,7 +112,7 @@ in
environment.etc."fish/nixos-env-preinit.fish".text = '' environment.etc."fish/nixos-env-preinit.fish".text = ''
# This happens before $__fish_datadir/config.fish sets fish_function_path, so it is currently # This happens before $__fish_datadir/config.fish sets fish_function_path, so it is currently
# unset. We set it and then completely erase it, leaving its configuration to $__fish_datadir/config.fish # unset. We set it and then completely erase it, leaving its configuration to $__fish_datadir/config.fish
set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $__fish_datadir/functions set fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d $__fish_datadir/functions
# source the NixOS environment config # source the NixOS environment config
if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ] if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]
@ -128,7 +128,7 @@ in
# if we haven't sourced the general config, do it # if we haven't sourced the general config, do it
if not set -q __fish_nixos_general_config_sourced if not set -q __fish_nixos_general_config_sourced
set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path set --prepend fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d
fenv source /etc/fish/foreign-env/shellInit > /dev/null fenv source /etc/fish/foreign-env/shellInit > /dev/null
set -e fish_function_path[1] set -e fish_function_path[1]
@ -142,7 +142,7 @@ in
# if we haven't sourced the login config, do it # if we haven't sourced the login config, do it
status --is-login; and not set -q __fish_nixos_login_config_sourced status --is-login; and not set -q __fish_nixos_login_config_sourced
and begin and begin
set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path set --prepend fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d
fenv source /etc/fish/foreign-env/loginShellInit > /dev/null fenv source /etc/fish/foreign-env/loginShellInit > /dev/null
set -e fish_function_path[1] set -e fish_function_path[1]
@ -158,7 +158,7 @@ in
and begin and begin
${fishAliases} ${fishAliases}
set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path set --prepend fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d
fenv source /etc/fish/foreign-env/interactiveShellInit > /dev/null fenv source /etc/fish/foreign-env/interactiveShellInit > /dev/null
set -e fish_function_path[1] set -e fish_function_path[1]

View File

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

View File

@ -1,7 +1,7 @@
{ stdenv, fetchFromGitHub, gnused, bash, coreutils }: { lib, buildFishPlugin, fetchFromGitHub, gnused, bash, coreutils }:
stdenv.mkDerivation { buildFishPlugin {
pname = "fish-foreign-env"; pname = "foreign-env";
version = "git-20200209"; version = "git-20200209";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -11,18 +11,16 @@ stdenv.mkDerivation {
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"; sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
}; };
installPhase = '' patches = [ ./suppress-harmless-warnings.patch ];
mkdir -p $out/share/fish-foreign-env/functions/
cp functions/* $out/share/fish-foreign-env/functions/ preInstall = ''
sed -e "s|sed|${gnused}/bin/sed|" \ sed -e "s|sed|${gnused}/bin/sed|" \
-e "s|bash|${bash}/bin/bash|" \ -e "s|bash|${bash}/bin/bash|" \
-e "s|\| tr|\| ${coreutils}/bin/tr|" \ -e "s|\| tr|\| ${coreutils}/bin/tr|" \
-i $out/share/fish-foreign-env/functions/* -i functions/*
''; '';
patches = [ ./suppress-harmless-warnings.patch ]; meta = with lib; {
meta = with stdenv.lib; {
description = "A foreign environment interface for Fish shell"; description = "A foreign environment interface for Fish shell";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ jgillich ]; maintainers = with maintainers; [ jgillich ];

View File

@ -158,6 +158,7 @@ mapAliases ({
firefoxWrapper = firefox; # 2015-09 firefoxWrapper = firefox; # 2015-09
firestr = throw "firestr has been removed."; # added 2019-12-08 firestr = throw "firestr has been removed."; # added 2019-12-08
fish-foreign-env = fishPlugins.foreign-env; # added 2020-12-29
flameGraph = flamegraph; # added 2018-04-25 flameGraph = flamegraph; # added 2018-04-25
flvtool2 = throw "flvtool2 has been removed."; # added 2020-11-03 flvtool2 = throw "flvtool2 has been removed."; # added 2020-11-03
foldingathome = fahclient; # added 2020-09-03 foldingathome = fahclient; # added 2020-09-03

View File

@ -8841,8 +8841,6 @@ in
fishPlugins = recurseIntoAttrs (callPackage ../shells/fish/plugins { }); fishPlugins = recurseIntoAttrs (callPackage ../shells/fish/plugins { });
fish-foreign-env = callPackage ../shells/fish/fish-foreign-env { };
ion = callPackage ../shells/ion { ion = callPackage ../shells/ion {
inherit (darwin) Security; inherit (darwin) Security;
}; };