git.iko.soy/typeable/nixpkgs
on master help sign in
cantata: clean up options handling
commit15254515d00dbf54bd97624e6a93fab703bca07b authorPeter Hoeg <peter@hoeg.com> dateSun 16 May 2021, 17:04 (6 years ago) parent594fbfe
1 file changed+25−33
pkgs/applications/audio/cantata/default.nix+25−33
pkgs/applications/audio/cantata/default.nix+25−33
@@ -54,12 +54,26 @@ let
5454 fstat = x: fn:
5555 "-DENABLE_${fn}=${if x then "ON" else "OFF"}";
5656
57− fstats = x:
58− map (fstat x);
59−
6057 withUdisks = (withTaglib && withDevices);
6158
62− perl' = perl.withPackages (ppkgs: with ppkgs; [ URI ]);
59+ options = [
60+ { names = [ "CDDB" ]; enable = withCddb; pkgs = [ libcddb ]; }
61+ { names = [ "CDPARANOIA" ]; enable = withCdda; pkgs = [ cdparanoia ]; }
62+ { names = [ "DEVICES_SUPPORT" ]; enable = withDevices; pkgs = [ ]; }
63+ { names = [ "DYNAMIC" ]; enable = withDynamic; pkgs = [ ]; }
64+ { names = [ "FFMPEG" "MPG123" "SPEEXDSP" ]; enable = withReplaygain; pkgs = [ ffmpeg speex mpg123 ]; }
65+ { names = [ "HTTPS_SUPPORT" ]; enable = true; pkgs = [ ]; }
66+ { names = [ "HTTP_SERVER" ]; enable = withHttpServer; pkgs = [ ]; }
67+ { names = [ "HTTP_STREAM_PLAYBACK" ]; enable = withHttpStream; pkgs = [ qtmultimedia ]; }
68+ { names = [ "LAME" ]; enable = withLame; pkgs = [ lame ]; }
69+ { names = [ "LIBVLC" ]; enable = withLibVlc; pkgs = [ libvlc ]; }
70+ { names = [ "MTP" ]; enable = withMtp; pkgs = [ libmtp ]; }
71+ { names = [ "MUSICBRAINZ" ]; enable = withMusicbrainz; pkgs = [ libmusicbrainz5 ]; }
72+ { names = [ "ONLINE_SERVICES" ]; enable = withOnlineServices; pkgs = [ ]; }
73+ { names = [ "STREAMS" ]; enable = withStreams; pkgs = [ ]; }
74+ { names = [ "TAGLIB" "TAGLIB_EXTRAS" ]; enable = withTaglib; pkgs = [ taglib taglib_extras ]; }
75+ { names = [ "UDISKS2" ]; enable = withUdisks; pkgs = [ udisks2 ]; }
76+ ];
6377
6478in
6579mkDerivation rec {
@@ -84,38 +98,16 @@ mkDerivation rec {
8498 patchShebangs playlists
8599 '';
86100
87− buildInputs = [ qtbase qtsvg perl' ]
88− ++ lib.optionals withTaglib [ taglib taglib_extras ]
89− ++ lib.optionals withReplaygain [ ffmpeg speex mpg123 ]
90− ++ lib.optional withHttpStream qtmultimedia
91− ++ lib.optional withCdda cdparanoia
92− ++ lib.optional withCddb libcddb
93− ++ lib.optional withLame lame
94− ++ lib.optional withMtp libmtp
95− ++ lib.optional withMusicbrainz libmusicbrainz5
96− ++ lib.optional withUdisks udisks2
97− ++ lib.optional withLibVlc libvlc;
101+ buildInputs = [
102+ qtbase
103+ qtsvg
104+ (perl.withPackages (ppkgs: with ppkgs; [ URI ]))
105+ ]
106+ ++ lib.flatten (builtins.catAttrs "pkgs" (builtins.filter (e: e.enable) options));
98107
99108 nativeBuildInputs = [ cmake pkg-config qttools ];
100109
101− cmakeFlags = lib.flatten [
102− (fstats withTaglib [ "TAGLIB" "TAGLIB_EXTRAS" ])
103− (fstats withReplaygain [ "FFMPEG" "MPG123" "SPEEXDSP" ])
104− (fstat withHttpStream "HTTP_STREAM_PLAYBACK")
105− (fstat withCdda "CDPARANOIA")
106− (fstat withCddb "CDDB")
107− (fstat withLame "LAME")
108− (fstat withMtp "MTP")
109− (fstat withMusicbrainz "MUSICBRAINZ")
110− (fstat withOnlineServices "ONLINE_SERVICES")
111− (fstat withDynamic "DYNAMIC")
112− (fstat withDevices "DEVICES_SUPPORT")
113− (fstat withHttpServer "HTTP_SERVER")
114− (fstat withLibVlc "LIBVLC")
115− (fstat withStreams "STREAMS")
116− (fstat withUdisks "UDISKS2")
117− "-DENABLE_HTTPS_SUPPORT=ON"
118− ];
110+ cmakeFlags = lib.flatten (map (e: map (f: fstat e.enable f) e.names) options);
119111
120112 meta = with lib; {
121113 description = "A graphical client for MPD";