From deb2f07f229052312a4445f2f96a4b6731312bfe Mon Sep 17 00:00:00 2001 From: huantian Date: Wed, 21 Aug 2024 12:25:19 -0700 Subject: [PATCH 1/5] tauon: format with nixfmt --- pkgs/applications/audio/tauon/default.nix | 98 ++++++++++++----------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/pkgs/applications/audio/tauon/default.nix b/pkgs/applications/audio/tauon/default.nix index da77d6aeb5de..4f407cda357d 100644 --- a/pkgs/applications/audio/tauon/default.nix +++ b/pkgs/applications/audio/tauon/default.nix @@ -1,28 +1,29 @@ -{ lib -, stdenv -, fetchFromGitHub -, pkg-config -, python3Packages -, ffmpeg -, flac -, libjxl -, librsvg -, game-music-emu -, gobject-introspection -, gtk3 -, kissfft -, libappindicator -, libnotify -, libsamplerate -, libvorbis -, miniaudio -, mpg123 -, libopenmpt -, opusfile -, wavpack -, pango -, pulseaudio -, withDiscordRPC ? false +{ + lib, + stdenv, + fetchFromGitHub, + pkg-config, + python3Packages, + ffmpeg, + flac, + libjxl, + librsvg, + game-music-emu, + gobject-introspection, + gtk3, + kissfft, + libappindicator, + libnotify, + libsamplerate, + libvorbis, + miniaudio, + mpg123, + libopenmpt, + opusfile, + wavpack, + pango, + pulseaudio, + withDiscordRPC ? false, }: stdenv.mkDerivation (finalAttrs: { @@ -90,31 +91,34 @@ stdenv.mkDerivation (finalAttrs: { wavpack ]; - pythonPath = with python3Packages; [ - beautifulsoup4 - gst-python - dbus-python - isounidecode - libjxl - musicbrainzngs - mutagen - natsort - pillow - plexapi - pycairo - pychromecast - pylast - pygobject3 - pylyrics - pysdl2 - requests - send2trash - setproctitle - ] ++ lib.optional withDiscordRPC pypresence + pythonPath = + with python3Packages; + [ + beautifulsoup4 + gst-python + dbus-python + isounidecode + libjxl + musicbrainzngs + mutagen + natsort + pillow + plexapi + pycairo + pychromecast + pylast + pygobject3 + pylyrics + pysdl2 + requests + send2trash + setproctitle + ] + ++ lib.optional withDiscordRPC pypresence ++ lib.optional stdenv.isLinux pulsectl; makeWrapperArgs = [ - "--prefix PATH : ${lib.makeBinPath [ffmpeg]}" + "--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}" "--prefix LD_LIBRARY_PATH : ${pulseaudio}/lib" "--prefix PYTHONPATH : $out/share/tauon" "--set GI_TYPELIB_PATH $GI_TYPELIB_PATH" From 51afc33a17280bb5f0758981ad244ecb43417010 Mon Sep 17 00:00:00 2001 From: huantian Date: Wed, 21 Aug 2024 12:27:41 -0700 Subject: [PATCH 2/5] tauon: fix build error If the interpreter path to bash after patchShebang contians the string 'gcc', then we will end up mangaling the shebang interpreter path with the substituteInPlace on 'gcc' that follows the patchShebang. We can fix this by switching the order of the two, but since this script is only used once during compilation, it's simplier just to call bash directly to run the script. --- pkgs/applications/audio/tauon/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/applications/audio/tauon/default.nix b/pkgs/applications/audio/tauon/default.nix index 4f407cda357d..08cca1791ce2 100644 --- a/pkgs/applications/audio/tauon/default.nix +++ b/pkgs/applications/audio/tauon/default.nix @@ -58,15 +58,13 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace t_modules/t_phazor.py \ --replace 'lib/libphazor.so' '../../lib/libphazor.so' - patchShebangs compile-phazor.sh - substituteInPlace compile-phazor.sh --replace 'gcc' '${stdenv.cc.targetPrefix}cc' substituteInPlace extra/tauonmb.desktop --replace 'Exec=/opt/tauon-music-box/tauonmb.sh' 'Exec=${placeholder "out"}/bin/tauon' ''; postBuild = '' - ./compile-phazor.sh + bash ./compile-phazor.sh ''; nativeBuildInputs = [ From a2fcb4e05cde503620449cda5f38ed893781c31c Mon Sep 17 00:00:00 2001 From: huantian Date: Wed, 21 Aug 2024 12:30:19 -0700 Subject: [PATCH 3/5] tauon: update substituteInPlace patches --- pkgs/applications/audio/tauon/default.nix | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/audio/tauon/default.nix b/pkgs/applications/audio/tauon/default.nix index 08cca1791ce2..9a5f5b9e6cce 100644 --- a/pkgs/applications/audio/tauon/default.nix +++ b/pkgs/applications/audio/tauon/default.nix @@ -47,20 +47,19 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' substituteInPlace tauon.py \ - --replace 'install_mode = False' 'install_mode = True' \ - --replace 'install_directory = os.path.dirname(os.path.abspath(__file__))' 'install_directory = "${placeholder "out"}/share/tauon"' + --replace-fail 'install_mode = False' 'install_mode = True' \ + --replace-fail 'install_directory = os.path.dirname(os.path.abspath(__file__))' 'install_directory = "${placeholder "out"}/share/tauon"' substituteInPlace t_modules/t_main.py \ - --replace 'install_mode = False' 'install_mode = True' \ - --replace 'libopenmpt.so' '${lib.getLib libopenmpt}/lib/libopenmpt.so' \ - --replace 'lib/libphazor.so' '../../lib/libphazor.so' + --replace-fail 'install_mode = False' 'install_mode = True' \ + --replace-fail 'libopenmpt.so' '${lib.getLib libopenmpt}/lib/libopenmpt.so' substituteInPlace t_modules/t_phazor.py \ - --replace 'lib/libphazor.so' '../../lib/libphazor.so' + --replace-fail 'lib/libphazor.so' '../../lib/libphazor.so' - substituteInPlace compile-phazor.sh --replace 'gcc' '${stdenv.cc.targetPrefix}cc' + substituteInPlace compile-phazor.sh --replace-fail 'gcc' '${stdenv.cc.targetPrefix}cc' - substituteInPlace extra/tauonmb.desktop --replace 'Exec=/opt/tauon-music-box/tauonmb.sh' 'Exec=${placeholder "out"}/bin/tauon' + substituteInPlace extra/tauonmb.desktop --replace-fail 'Exec=/opt/tauon-music-box/tauonmb.sh' 'Exec=${placeholder "out"}/bin/tauon' ''; postBuild = '' From b24f9173e6b78a9a65704e049e6eefe47fa90fa2 Mon Sep 17 00:00:00 2001 From: huantian Date: Wed, 21 Aug 2024 12:37:15 -0700 Subject: [PATCH 4/5] tauon: remove unused depedencies and fix runtime dependency game-music-emu needs to be in LD_LIBRARY_PATH for the app to find it. gst-python and pylyrics are no longer used. tauon does have optional support for libjxl, but it's via the python library pyjxl and not directly with the C library. --- pkgs/applications/audio/tauon/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/audio/tauon/default.nix b/pkgs/applications/audio/tauon/default.nix index 9a5f5b9e6cce..660348fcf84d 100644 --- a/pkgs/applications/audio/tauon/default.nix +++ b/pkgs/applications/audio/tauon/default.nix @@ -6,7 +6,6 @@ python3Packages, ffmpeg, flac, - libjxl, librsvg, game-music-emu, gobject-introspection, @@ -92,10 +91,9 @@ stdenv.mkDerivation (finalAttrs: { with python3Packages; [ beautifulsoup4 - gst-python dbus-python isounidecode - libjxl + jxlpy musicbrainzngs mutagen natsort @@ -105,7 +103,6 @@ stdenv.mkDerivation (finalAttrs: { pychromecast pylast pygobject3 - pylyrics pysdl2 requests send2trash @@ -116,7 +113,12 @@ stdenv.mkDerivation (finalAttrs: { makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}" - "--prefix LD_LIBRARY_PATH : ${pulseaudio}/lib" + "--prefix LD_LIBRARY_PATH : ${ + lib.makeLibraryPath [ + game-music-emu + pulseaudio + ] + }" "--prefix PYTHONPATH : $out/share/tauon" "--set GI_TYPELIB_PATH $GI_TYPELIB_PATH" ]; From f66ce6a56f28f62623fd02f1ce94335892bd4a27 Mon Sep 17 00:00:00 2001 From: huantian Date: Wed, 21 Aug 2024 12:46:58 -0700 Subject: [PATCH 5/5] tauon: sort arguments by usage order --- pkgs/applications/audio/tauon/default.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/audio/tauon/default.nix b/pkgs/applications/audio/tauon/default.nix index 660348fcf84d..b134aa4b43d1 100644 --- a/pkgs/applications/audio/tauon/default.nix +++ b/pkgs/applications/audio/tauon/default.nix @@ -2,25 +2,25 @@ lib, stdenv, fetchFromGitHub, + kissfft, + miniaudio, pkg-config, python3Packages, - ffmpeg, - flac, - librsvg, - game-music-emu, gobject-introspection, + flac, + game-music-emu, gtk3, - kissfft, libappindicator, libnotify, + libopenmpt, + librsvg, libsamplerate, libvorbis, - miniaudio, mpg123, - libopenmpt, opusfile, - wavpack, pango, + wavpack, + ffmpeg, pulseaudio, withDiscordRPC ? false, }: