10 # Cantata doesn't build with cdparanoia enabled so we disable that
11 # default for now until I (or someone else) figure it out.
18 withMusicbrainz ? false,
24 withHttpStream ? true,
25 withReplaygain ? true,
31 withOnlineServices ? true,
35 withHttpServer ? true,
42 assert withCddb -> withCdda && withTaglib;
43 assert withCdda -> withCddb && withMusicbrainz;
44 assert withLame -> withCdda && withTaglib;
45 assert withMtp -> withTaglib;
46 assert withMusicbrainz -> withCdda && withTaglib;
47 assert withOnlineServices -> withTaglib;
48 assert withReplaygain -> withTaglib;
49 assert withLibVlc -> withHttpStream;
52 fstat = x: fn: "-DENABLE_${fn}=${if x then "ON" else "OFF"}";
54 withUdisks = (withTaglib && withDevices && stdenv.hostPlatform.isLinux);
63 names = [ "CDPARANOIA" ];
65 pkgs = [ cdparanoia ];
68 names = [ "DEVICES_SUPPORT" ];
73 names = [ "DYNAMIC" ];
83 enable = withReplaygain;
91 names = [ "HTTPS_SUPPORT" ];
96 names = [ "HTTP_SERVER" ];
97 enable = withHttpServer;
101 names = [ "HTTP_STREAM_PLAYBACK" ];
102 enable = withHttpStream;
103 pkgs = [ qt5.qtmultimedia ];
111 names = [ "LIBVLC" ];
121 names = [ "MUSICBRAINZ" ];
122 enable = withMusicbrainz;
123 pkgs = [ libmusicbrainz5 ];
126 names = [ "ONLINE_SERVICES" ];
127 enable = withOnlineServices;
131 names = [ "STREAMS" ];
132 enable = withStreams;
147 names = [ "UDISKS2" ];
154 stdenv.mkDerivation (finalAttrs: {
158 src = fetchFromGitHub {
161 rev = "v${finalAttrs.version}";
162 hash = "sha256-UaZEKZvCA50WsdQSSJQQ11KTK6rM4ouCHDX7pn3NlQw=";
166 # Cantata wants to check if perl is in the PATH at runtime, but we
167 # patchShebangs the playlists scripts, making that unnecessary (perl will
168 # always be available because it's a dependency)
169 ./dont-check-for-perl-in-PATH.diff
173 patchShebangs playlists
179 (perl.withPackages (ppkgs: with ppkgs; [ URI ]))
180 ] ++ lib.flatten (builtins.catAttrs "pkgs" (builtins.filter (e: e.enable) options));
182 nativeBuildInputs = [
189 cmakeFlags = lib.flatten (map (e: map (f: fstat e.enable f) e.names) options);
192 description = "Graphical client for MPD";
193 mainProgram = "cantata";
194 homepage = "https://github.com/cdrummond/cantata";
195 license = lib.licenses.gpl3Only;
196 maintainers = with lib.maintainers; [ peterhoeg ];
197 # Technically, Cantata should run on Darwin/Windows so if someone wants to
198 # bother figuring that one out, be my guest.
199 platforms = lib.platforms.unix;
200 badPlatforms = lib.platforms.darwin;