1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchPypi,
6 kissfft,
7 miniaudio,
8 pkg-config,
9 python3Packages,
10 gobject-introspection,
11 flac,
12 game-music-emu,
13 gtk3,
14 libappindicator,
15 libnotify,
16 libopenmpt,
17 librsvg,
18 libsamplerate,
19 libvorbis,
20 xorg,
21 mpg123,
22 opusfile,
23 pango,
24 pipewire,
25 wavpack,
26 ffmpeg,
27 pulseaudio,
28 withDiscordRPC ? true,
29}:
30
31let
32 # fork of pypresence, to be reverted if/when there's an upstream release
33 lynxpresence = python3Packages.buildPythonPackage rec {
34 pname = "lynxpresence";
35 version = "4.4.1";
36 pyproject = true;
37
38 src = fetchPypi {
39 inherit pname version;
40 hash = "sha256-y/KboyhEGs9RvyKayEIQu2+WaiQNOdsHDl1/pEoqEkQ=";
41 };
42
43 build-system = with python3Packages; [ setuptools ];
44
45 doCheck = false; # tests require internet connection
46 pythonImportsCheck = [ "lynxpresence" ];
47 };
48in
49python3Packages.buildPythonApplication rec {
50 pname = "tauon";
51 version = "8.0.1";
52 pyproject = true;
53
54 src = fetchFromGitHub {
55 owner = "Taiko2k";
56 repo = "Tauon";
57 tag = "v${version}";
58 hash = "sha256-m94/zdlJu/u/dchIXhqB47bkl6Uej2hVr8R6RNg8Vaw=";
59 };
60
61 postUnpack = ''
62 rmdir source/src/phazor/kissfft
63 ln -s ${kissfft.src} source/src/phazor/kissfft
64
65 rmdir source/src/phazor/miniaudio
66 ln -s ${miniaudio.src} source/src/phazor/miniaudio
67 '';
68
69 patches = [
70 ./install_mode_true.patch
71 ];
72
73 postPatch = ''
74 substituteInPlace src/tauon/t_modules/t_phazor.py \
75 --replace-fail 'base_path = Path(pctl.install_directory).parent.parent / "build"' 'base_path = Path("${placeholder "out"}/${python3Packages.python.sitePackages}")'
76 '';
77
78 pythonRemoveDeps = [
79 "opencc"
80 "tekore"
81 ];
82
83 nativeBuildInputs = [
84 pkg-config
85 python3Packages.wrapPython
86 gobject-introspection
87 ];
88
89 build-system = with python3Packages; [
90 setuptools
91 setuptools-scm
92 ];
93
94 buildInputs = [
95 flac
96 game-music-emu
97 gtk3
98 libappindicator
99 libnotify
100 libopenmpt
101 librsvg
102 libsamplerate
103 libvorbis
104 mpg123
105 opusfile
106 pango
107 pipewire
108 wavpack
109 ];
110
111 pythonPath =
112 with python3Packages;
113 [
114 beautifulsoup4
115 colored-traceback
116 dbus-python
117 unidecode
118 jxlpy
119 musicbrainzngs
120 mutagen
121 natsort
122 pillow
123 plexapi
124 pycairo
125 pychromecast
126 pylast
127 pygobject3
128 pysdl3
129 requests
130 send2trash
131 setproctitle
132 tidalapi
133 ]
134 ++ lib.optional withDiscordRPC lynxpresence
135 ++ lib.optional stdenv.hostPlatform.isLinux pulsectl;
136
137 makeWrapperArgs = [
138 "--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}"
139 "--prefix LD_LIBRARY_PATH : ${
140 lib.makeLibraryPath (
141 [
142 game-music-emu
143 libopenmpt
144 pulseaudio
145 ]
146 ++ lib.optional stdenv.hostPlatform.isLinux xorg.libXcursor
147 )
148 }"
149 "--prefix PYTHONPATH : $out/share/tauon"
150 "--set GI_TYPELIB_PATH $GI_TYPELIB_PATH"
151 ];
152
153 postInstall = ''
154 mv $out/bin/tauonmb $out/bin/tauon
155 mkdir -p $out/share/applications
156 install -Dm755 extra/tauonmb.desktop $out/share/applications/tauonmb.desktop
157 mkdir -p $out/share/icons/hicolor/scalable/apps
158 install -Dm644 extra/tauonmb{,-symbolic}.svg $out/share/icons/hicolor/scalable/apps
159 '';
160
161 meta = {
162 description = "Linux desktop music player from the future";
163 mainProgram = "tauon";
164 homepage = "https://tauonmusicbox.rocks/";
165 changelog = "https://github.com/Taiko2k/Tauon/releases/tag/v${version}";
166 license = lib.licenses.gpl3;
167 maintainers = with lib.maintainers; [ jansol ];
168 platforms = lib.platforms.linux ++ lib.platforms.darwin;
169 };
170}