From 40e2f9fb032a517839c1f0b774155c8917da00d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 14 Mar 2021 19:41:58 +0100 Subject: [PATCH] ytfzf: 1.0.1 -> 1.1.0 Prevent ytfzf from installing its own updates. Add all programs that are possibly used in the script to $PATH. A 10M increase in closure size seems very acceptable. --- pkgs/tools/misc/ytfzf/default.nix | 15 +++++++++++--- pkgs/tools/misc/ytfzf/no-update.patch | 30 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 pkgs/tools/misc/ytfzf/no-update.patch diff --git a/pkgs/tools/misc/ytfzf/default.nix b/pkgs/tools/misc/ytfzf/default.nix index 9feecb589126..56e139941b2a 100644 --- a/pkgs/tools/misc/ytfzf/default.nix +++ b/pkgs/tools/misc/ytfzf/default.nix @@ -2,25 +2,34 @@ , stdenv , fetchFromGitHub , makeWrapper +, coreutils , curl , dmenu , fzf +, gnused , jq , mpv +, ncurses +, ueberzug , youtube-dl }: stdenv.mkDerivation rec { pname = "ytfzf"; - version = "1.0.1"; + version = "1.1.0"; src = fetchFromGitHub { owner = "pystardust"; repo = "ytfzf"; rev = "v${version}"; - sha256 = "1i9ya38zcaj1vkfgy1n4gp5vqb59zlrd609pdmz4jqinrb0c5fgv"; + sha256 = "sha256-ATQRXYaIp1MKCO/EAPsopzFEZeNJzdk73/OcgjsMdkg="; }; + patches = [ + # Updates have to be installed through Nix. + ./no-update.patch + ]; + nativeBuildInputs = [ makeWrapper ]; makeFlags = [ "PREFIX=${placeholder "out"}/bin" ]; @@ -29,7 +38,7 @@ stdenv.mkDerivation rec { postInstall = '' wrapProgram "$out/bin/ytfzf" --prefix PATH : ${lib.makeBinPath [ - curl dmenu fzf jq mpv youtube-dl + coreutils curl dmenu fzf gnused jq mpv ncurses ueberzug youtube-dl ]} ''; diff --git a/pkgs/tools/misc/ytfzf/no-update.patch b/pkgs/tools/misc/ytfzf/no-update.patch new file mode 100644 index 000000000000..07ca62cd9434 --- /dev/null +++ b/pkgs/tools/misc/ytfzf/no-update.patch @@ -0,0 +1,30 @@ +diff --git a/ytfzf b/ytfzf +index 5238682..c5c3a1a 100755 +--- a/ytfzf ++++ b/ytfzf +@@ -757,23 +757,8 @@ clear_history () { + } + + update_ytfzf () { +- branch="$1" +- updatefile="/tmp/ytfzf-update" +- curl -L "https://raw.githubusercontent.com/pystardust/ytfzf/$branch/ytfzf" -o "$updatefile" +- +- if sed -n '1p' < "$updatefile" | grep -q '#!/bin/sh' ; then +- chmod 755 "$updatefile" +- if [ "$(uname)" = "Darwin" ]; then +- sudo cp "$updatefile" "/usr/local/bin/ytfzf" +- else +- sudo cp "$updatefile" "/usr/bin/ytfzf" +- fi +- else +- printf "%bFailed to update ytfzf. Try again later.%b" "$c_red" "$c_reset" +- fi +- +- rm "$updatefile" +- exit ++ printf "%bUpdates have to be installed through Nix.%b\n" "$c_red" "$c_reset" ++ exit 1 + } + +