From 1693ed2be9e6904c9a4621da37b2c5a7c5529789 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Wed, 21 Dec 2022 03:12:24 -0600 Subject: [PATCH] fzf: wrap 'perl' in scripts with LOCALE_ARCHIVE Signed-off-by: Austin Seipp --- pkgs/tools/misc/fzf/default.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/fzf/default.nix b/pkgs/tools/misc/fzf/default.nix index 0ea167a5053c..bf1884d311ee 100644 --- a/pkgs/tools/misc/fzf/default.nix +++ b/pkgs/tools/misc/fzf/default.nix @@ -1,4 +1,6 @@ -{ lib +{ stdenv +, lib +, pkgs , buildGoModule , fetchFromGitHub , writeText @@ -6,7 +8,20 @@ , installShellFiles , ncurses , perl +, glibcLocales }: + +let + # on Linux, wrap perl in the bash completion scripts with the glibc locales, + # so that using the shell completion (ctrl+r, etc) doesn't result in ugly + # warnings on non-nixos machines + ourPerl = if stdenv.isDarwin then perl else ( + pkgs.writers.writeBashBin "perl" '' + #!${pkgs.runtimeShell} + export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive" + exec ${perl}/bin/perl "$@" + ''); +in buildGoModule rec { pname = "fzf"; version = "0.35.1"; @@ -42,7 +57,7 @@ buildGoModule rec { # Has a sneaky dependency on perl # Include first args to make sure we're patching the right thing substituteInPlace shell/key-bindings.bash \ - --replace " perl -n " " ${perl}/bin/perl -n " + --replace " perl -n " " ${ourPerl}/bin/perl -n " ''; postInstall = ''