From dd922563afb0370d82e8141dca1e7691c92f96f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Thu, 16 Feb 2023 02:24:28 +0900 Subject: [PATCH 1/4] mpg123: add lib-only derivation not depending on sound servers --- pkgs/applications/audio/mpg123/default.nix | 25 ++++++++++++++-------- pkgs/top-level/all-packages.nix | 5 +++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/audio/mpg123/default.nix b/pkgs/applications/audio/mpg123/default.nix index 3eb2cf20ee77..36c8a2409abb 100644 --- a/pkgs/applications/audio/mpg123/default.nix +++ b/pkgs/applications/audio/mpg123/default.nix @@ -3,7 +3,7 @@ , fetchurl , makeWrapper , pkg-config -, perl +, libOnly ? false # whether to build only the library , withAlsa ? stdenv.hostPlatform.isLinux , alsa-lib , withPulse ? stdenv.hostPlatform.isLinux @@ -14,29 +14,36 @@ , withJack ? stdenv.hostPlatform.isUnix , jack , withConplay ? !stdenv.hostPlatform.isWindows +, perl }: +assert withConplay -> !libOnly; + stdenv.mkDerivation rec { - pname = "mpg123"; + pname = "${lib.optionalString libOnly "lib"}mpg123"; version = "1.31.2"; src = fetchurl { - url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.bz2"; + url = "mirror://sourceforge/mpg123/mpg123-${version}.tar.bz2"; sha256 = "sha256-sX8ikF4x9DtrQB399qce0Ru30Fb2jbRJ1wufmug5x94="; }; - outputs = [ "out" ] ++ lib.optionals withConplay [ "conplay" ]; + outputs = [ "out" ] ++ lib.optional withConplay "conplay"; - nativeBuildInputs = lib.optionals withConplay [ makeWrapper ] - ++ lib.optionals (withPulse || withJack) [ pkg-config ]; + nativeBuildInputs = lib.optionals (!libOnly) ( + lib.optionals withConplay [ makeWrapper ] + ++ lib.optionals (withPulse || withJack) [ pkg-config ] + ); - buildInputs = lib.optionals withConplay [ perl ] + buildInputs = lib.optionals (!libOnly) ( + lib.optionals withConplay [ perl ] ++ lib.optionals withAlsa [ alsa-lib ] ++ lib.optionals withPulse [ libpulseaudio ] ++ lib.optionals withCoreAudio [ AudioUnit AudioToolbox ] - ++ lib.optionals withJack [ jack ]; + ++ lib.optionals withJack [ jack ] + ); - configureFlags = [ + configureFlags = lib.optionals (!libOnly) [ "--with-audio=${lib.strings.concatStringsSep "," ( lib.optional withJack "jack" ++ lib.optional withPulse "pulse" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 37c573123715..8552a0b44754 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31843,6 +31843,11 @@ with pkgs; jack = libjack2; }; + libmpg123 = mpg123.override { + libOnly = true; + withConplay = false; + }; + mpg321 = callPackage ../applications/audio/mpg321 { }; mpc-cli = callPackage ../applications/audio/mpc { From 9f6d48ae2ec27b35bb8bd656ba8b1c22e7da196e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Thu, 16 Feb 2023 02:28:10 +0900 Subject: [PATCH 2/4] libsndfile: enable MP3 support --- pkgs/development/libraries/libsndfile/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix index a319de5ce6b2..8c07a8c586ba 100644 --- a/pkgs/development/libraries/libsndfile/default.nix +++ b/pkgs/development/libraries/libsndfile/default.nix @@ -1,4 +1,5 @@ -{ lib, stdenv, fetchFromGitHub, autoreconfHook, autogen, flac, libogg, libopus, libvorbis, pkg-config, python3 +{ lib, stdenv, fetchFromGitHub, autoreconfHook, autogen, pkg-config, python3 +, flac, lame, libmpg123, libogg, libopus, libvorbis , Carbon, AudioToolbox }: @@ -14,7 +15,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ autoreconfHook autogen pkg-config python3 ]; - buildInputs = [ flac libogg libopus libvorbis ] + buildInputs = [ flac lame libmpg123 libogg libopus libvorbis ] ++ lib.optionals stdenv.isDarwin [ Carbon AudioToolbox ]; enableParallelBuilding = true; From 1b80b55648e705c8c6034b39dad67b6940289d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Thu, 16 Feb 2023 02:28:24 +0900 Subject: [PATCH 3/4] libsndfile: 1.1.0 -> 1.2.0 --- pkgs/development/libraries/libsndfile/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix index 8c07a8c586ba..a32acb9f811b 100644 --- a/pkgs/development/libraries/libsndfile/default.nix +++ b/pkgs/development/libraries/libsndfile/default.nix @@ -5,13 +5,13 @@ stdenv.mkDerivation rec { pname = "libsndfile"; - version = "1.1.0"; + version = "1.2.0"; src = fetchFromGitHub { owner = pname; repo = pname; rev = version; - sha256 = "sha256-bhIXVSKuUnUzs5aaLDHt21RcnqekEpLU414sFtl2Lro="; + hash = "sha256-zd0HDUzVYLyFjhIudBJQaKJUtYMjZeQRLALSkyD9tXU="; }; nativeBuildInputs = [ autoreconfHook autogen pkg-config python3 ]; @@ -35,6 +35,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "A C library for reading and writing files containing sampled sound"; homepage = "https://libsndfile.github.io/libsndfile/"; + changelog = "https://github.com/libsndfile/libsndfile/releases/tag/${version}"; license = licenses.lgpl2Plus; maintainers = with maintainers; [ lovek323 ]; platforms = platforms.unix; From 6477516d6d5d6a25e975d88ac8ed2405e6b846c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Thu, 16 Feb 2023 02:55:37 +0900 Subject: [PATCH 4/4] libsndfile: link sndfile-play with ALSA on GNU/Linux It otherwise falls back to OSS which no longer presents on most installations. --- pkgs/development/libraries/libsndfile/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix index a32acb9f811b..0dc795a96d84 100644 --- a/pkgs/development/libraries/libsndfile/default.nix +++ b/pkgs/development/libraries/libsndfile/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, fetchFromGitHub, autoreconfHook, autogen, pkg-config, python3 , flac, lame, libmpg123, libogg, libopus, libvorbis -, Carbon, AudioToolbox +, alsa-lib, Carbon, AudioToolbox }: stdenv.mkDerivation rec { @@ -16,6 +16,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook autogen pkg-config python3 ]; buildInputs = [ flac lame libmpg123 libogg libopus libvorbis ] + ++ lib.optionals stdenv.isLinux [ alsa-lib ] ++ lib.optionals stdenv.isDarwin [ Carbon AudioToolbox ]; enableParallelBuilding = true;