From 96012ae1052638373b08bd9d8b0251e93c9bd570 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Sat, 2 Dec 2023 20:38:15 +0800 Subject: [PATCH] hypnotix: 3.7 -> 4.0 https://github.com/linuxmint/hypnotix/compare/3.7...4.0 Since `~/.cache/hypnotix/favorites` is created by `usr/bin/hypnotix` the shell script, we need to actually install it. As a consequence, we also need to fix shebang for `usr/lib/hypnotix/hypnotix.py`, adding python3 as buildInputs should do the work. --- pkgs/applications/video/hypnotix/default.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/video/hypnotix/default.nix b/pkgs/applications/video/hypnotix/default.nix index 647f171c8731..bcf09b962483 100644 --- a/pkgs/applications/video/hypnotix/default.nix +++ b/pkgs/applications/video/hypnotix/default.nix @@ -9,17 +9,18 @@ , mpv , python3 , wrapGAppsHook +, yt-dlp }: stdenv.mkDerivation rec { pname = "hypnotix"; - version = "3.7"; + version = "4.0"; src = fetchFromGitHub { owner = "linuxmint"; repo = "hypnotix"; rev = version; - hash = "sha256-H8+KJ9+HLAorGIeljw8H3N8W3E2yYhAno1xy+jI54zM="; + hash = "sha256-0iJzlj5FRDXJdh+vWVvZaBJVNru7CfkvJtZUZYKoqPw="; }; patches = [ @@ -32,8 +33,12 @@ stdenv.mkDerivation rec { postPatch = '' substituteInPlace usr/lib/hypnotix/hypnotix.py \ --replace __DEB_VERSION__ ${version} \ + --replace /usr/bin/yt-dlp ${yt-dlp}/bin/yt-dlp \ --replace /usr/share/circle-flags-svg ${circle-flags}/share/circle-flags-svg \ --replace /usr/share/hypnotix $out/share/hypnotix + + substituteInPlace usr/bin/hypnotix \ + --replace /usr/lib/hypnotix/hypnotix.py $out/lib/hypnotix/hypnotix.py ''; nativeBuildInputs = [ @@ -47,6 +52,7 @@ stdenv.mkDerivation rec { buildInputs = [ cinnamon.xapp + python3 # for patchShebangs ]; pythonPath = with python3.pkgs; [ @@ -62,8 +68,7 @@ stdenv.mkDerivation rec { runHook preInstall mkdir -p $out - cp -r usr/lib $out - cp -r usr/share $out + cp -r usr/* $out glib-compile-schemas $out/share/glib-2.0/schemas @@ -72,8 +77,10 @@ stdenv.mkDerivation rec { preFixup = '' buildPythonPath "$out $pythonPath" - makeWrapper ${python3.interpreter} $out/bin/hypnotix \ - --add-flags $out/lib/hypnotix/hypnotix.py \ + + # yt-dlp is needed for mpv to play YouTube channels. + wrapProgram $out/bin/hypnotix \ + --prefix PATH : "${lib.makeBinPath [ yt-dlp ]}" \ --prefix PYTHONPATH : "$program_PYTHONPATH" \ ''${gappsWrapperArgs[@]} '';