git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit40e2f9fb032a517839c1f0b774155c8917da00d6 authorRobert Schütz <dev@schuetz-co.de> dateSun 14 Mar 2021, 19:41 (6 years ago) parent916ee86
2 files changed+42−3
pkgs/tools/misc/ytfzf/default.nix+12−3 pkgs/tools/misc/ytfzf/no-update.patch+30
pkgs/tools/misc/ytfzf/default.nix+12−3
@@ -2,25 +2,34 @@
22, stdenv
33, fetchFromGitHub
44, makeWrapper
5+, coreutils
56, curl
67, dmenu
78, fzf
9+, gnused
810, jq
911, mpv
12+, ncurses
13+, ueberzug
1014, youtube-dl
1115}:
1216
1317stdenv.mkDerivation rec {
1418 pname = "ytfzf";
15− version = "1.0.1";
19+ version = "1.1.0";
1620
1721 src = fetchFromGitHub {
1822 owner = "pystardust";
1923 repo = "ytfzf";
2024 rev = "v${version}";
21− sha256 = "1i9ya38zcaj1vkfgy1n4gp5vqb59zlrd609pdmz4jqinrb0c5fgv";
25+ sha256 = "sha256-ATQRXYaIp1MKCO/EAPsopzFEZeNJzdk73/OcgjsMdkg=";
2226 };
2327
28+ patches = [
29+ # Updates have to be installed through Nix.
30+ ./no-update.patch
31+ ];
32+
2433 nativeBuildInputs = [ makeWrapper ];
2534
2635 makeFlags = [ "PREFIX=${placeholder "out"}/bin" ];
@@ -29,7 +38,7 @@ stdenv.mkDerivation rec {
2938
3039 postInstall = ''
3140 wrapProgram "$out/bin/ytfzf" --prefix PATH : ${lib.makeBinPath [
32− curl dmenu fzf jq mpv youtube-dl
41+ coreutils curl dmenu fzf gnused jq mpv ncurses ueberzug youtube-dl
3342 ]}
3443 '';
3544
pkgs/tools/misc/ytfzf/no-update.patchnew file+30
@@ -0,0 +1,30 @@
1+diff --git a/ytfzf b/ytfzf
2+index 5238682..c5c3a1a 100755
3+--- a/ytfzf
4++++ b/ytfzf
5+@@ -757,23 +757,8 @@ clear_history () {
6+ }
7+
8+ update_ytfzf () {
9+- branch="$1"
10+- updatefile="/tmp/ytfzf-update"
11+- curl -L "https://raw.githubusercontent.com/pystardust/ytfzf/$branch/ytfzf" -o "$updatefile"
12+-
13+- if sed -n '1p' < "$updatefile" | grep -q '#!/bin/sh' ; then
14+- chmod 755 "$updatefile"
15+- if [ "$(uname)" = "Darwin" ]; then
16+- sudo cp "$updatefile" "/usr/local/bin/ytfzf"
17+- else
18+- sudo cp "$updatefile" "/usr/bin/ytfzf"
19+- fi
20+- else
21+- printf "%bFailed to update ytfzf. Try again later.%b" "$c_red" "$c_reset"
22+- fi
23+-
24+- rm "$updatefile"
25+- exit
26++ printf "%bUpdates have to be installed through Nix.%b\n" "$c_red" "$c_reset"
27++ exit 1
28+ }
29+
30+