1{
2 cmake,
3 fetchFromGitLab,
4 lib,
5 libnotify,
6 mkDerivation,
7 pkg-config,
8 qtbase,
9 qtdeclarative,
10 qtgraphicaleffects,
11 qtquickcontrols2,
12 qttools,
13 qtwebengine,
14 stdenv,
15}:
16
17mkDerivation rec {
18 pname = "MellowPlayer";
19 version = "3.6.8";
20
21 src = fetchFromGitLab {
22 owner = "ColinDuquesnoy";
23 repo = "MellowPlayer";
24 rev = version;
25 hash = "sha256-rsF2xQet7U8d4oGU/HgghvE3vvmkxjlGXPBlLD9mWTk=";
26 };
27
28 nativeBuildInputs = [
29 cmake
30 pkg-config
31 ];
32
33 buildInputs = [
34 libnotify
35 qtbase
36 qtdeclarative
37 qtgraphicaleffects
38 qtquickcontrols2
39 qttools
40 qtwebengine
41 ];
42
43 doCheck = true;
44
45 cmakeFlags = [ "-DBUILD_TESTS=ON" ];
46
47 preCheck = ''
48 # Running the tests requires a location at the home directory for logging.
49 export HOME="$NIX_BUILD_TOP/home"
50 mkdir -p "$HOME/.local/share/MellowPlayer.Tests/MellowPlayer.Tests/Logs"
51
52 # Without this, the tests fail because they cannot create the QT Window
53 export QT_QPA_PLATFORM=offscreen
54 ''
55 # TODO: The tests are failing because it can't locate QT plugins. Is there a better way to do this?
56 + (builtins.concatStringsSep "\n" (
57 lib.lists.flatten (
58 builtins.map (pkg: [
59 (lib.optionalString (pkg ? qtPluginPrefix) ''
60 export QT_PLUGIN_PATH="${pkg}/${pkg.qtPluginPrefix}"''${QT_PLUGIN_PATH:+':'}$QT_PLUGIN_PATH
61 '')
62
63 (lib.optionalString (pkg ? qtQmlPrefix) ''
64 export QML2_IMPORT_PATH="${pkg}/${pkg.qtQmlPrefix}"''${QML2_IMPORT_PATH:+':'}$QML2_IMPORT_PATH
65 '')
66 ]) buildInputs
67 )
68 ));
69
70 meta = with lib; {
71 inherit (qtbase.meta) platforms;
72 broken = stdenv.hostPlatform.isDarwin; # test build fails, but the project is not maintained anymore
73
74 description = "Cloud music integration for your desktop";
75 mainProgram = "MellowPlayer";
76 homepage = "https://gitlab.com/ColinDuquesnoy/MellowPlayer";
77 license = licenses.gpl2;
78 maintainers = with maintainers; [ kalbasit ];
79 };
80}