From d81070c8913dd94aa9f80df4db3471273731ccf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 8 Nov 2021 09:57:04 +0100 Subject: [PATCH] sox: remove ? null from inputs, cleanup meta, enable pulseaudio only on linux --- pkgs/applications/misc/audio/sox/default.nix | 68 ++++++++++---------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/pkgs/applications/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix index 02a9ab362952..29a932f40d58 100644 --- a/pkgs/applications/misc/audio/sox/default.nix +++ b/pkgs/applications/misc/audio/sox/default.nix @@ -5,36 +5,34 @@ , pkg-config , CoreAudio , enableAlsa ? true -, alsa-lib ? null +, alsa-lib , enableLibao ? true -, libao ? null +, libao , enableLame ? config.sox.enableLame or false -, lame ? null +, lame , enableLibmad ? true -, libmad ? null +, libmad , enableLibogg ? true -, libogg ? null -, libvorbis ? null +, libogg +, libvorbis , enableOpusfile ? true -, opusfile ? null +, opusfile , enableFLAC ? true -, flac ? null +, flac , enablePNG ? true -, libpng ? null +, libpng , enableLibsndfile ? true -, libsndfile ? null +, libsndfile , enableWavpack ? true -, wavpack ? null +, wavpack # amrnb and amrwb are unfree, disabled by default , enableAMR ? false -, amrnb ? null -, amrwb ? null -, enableLibpulseaudio ? true -, libpulseaudio ? null +, amrnb +, amrwb +, enableLibpulseaudio ? stdenv.isLinux +, libpulseaudio }: -with lib; - stdenv.mkDerivation rec { pname = "sox"; version = "14.4.2"; @@ -45,30 +43,30 @@ stdenv.mkDerivation rec { }; # configure.ac uses pkg-config only to locate libopusfile - nativeBuildInputs = optional enableOpusfile pkg-config; + nativeBuildInputs = lib.optional enableOpusfile pkg-config; patches = [ ./0001-musl-rewind-pipe-workaround.patch ]; buildInputs = - optional (enableAlsa && stdenv.isLinux) alsa-lib ++ - optional enableLibao libao ++ - optional enableLame lame ++ - optional enableLibmad libmad ++ - optionals enableLibogg [ libogg libvorbis ] ++ - optional enableOpusfile opusfile ++ - optional enableFLAC flac ++ - optional enablePNG libpng ++ - optional enableLibsndfile libsndfile ++ - optional enableWavpack wavpack ++ - optionals enableAMR [ amrnb amrwb ] ++ - optional enableLibpulseaudio libpulseaudio ++ - optional (stdenv.isDarwin) CoreAudio; + lib.optional (enableAlsa && stdenv.isLinux) alsa-lib + ++ lib.optional enableLibao libao + ++ lib.optional enableLame lame + ++ lib.optional enableLibmad libmad + ++ lib.optionals enableLibogg [ libogg libvorbis ] + ++ lib.optional enableOpusfile opusfile + ++ lib.optional enableFLAC flac + ++ lib.optional enablePNG libpng + ++ lib.optional enableLibsndfile libsndfile + ++ lib.optional enableWavpack wavpack + ++ lib.optionals enableAMR [ amrnb amrwb ] + ++ lib.optional enableLibpulseaudio libpulseaudio + ++ lib.optional stdenv.isDarwin CoreAudio; - meta = { + meta = with lib; { description = "Sample Rate Converter for audio"; homepage = "http://sox.sourceforge.net/"; - maintainers = [ lib.maintainers.marcweber ]; - license = if enableAMR then lib.licenses.unfree else lib.licenses.gpl2Plus; - platforms = lib.platforms.linux ++ lib.platforms.darwin; + maintainers = with maintainers; [ marcweber ]; + license = if enableAMR then licenses.unfree else licenses.gpl2Plus; + platforms = platforms.unix; }; }