2022-03-30 09:31:56 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, flac
|
|
|
|
, libmad
|
|
|
|
, libpulseaudio
|
|
|
|
, libvorbis
|
|
|
|
, mpg123
|
2023-05-24 13:37:59 +00:00
|
|
|
, audioBackend ? if stdenv.isLinux then "alsa" else "portaudio"
|
|
|
|
, alsaSupport ? stdenv.isLinux
|
|
|
|
, alsa-lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, dsdSupport ? true
|
2022-03-30 09:31:56 +00:00
|
|
|
, faad2Support ? true
|
|
|
|
, faad2
|
|
|
|
, ffmpegSupport ? true
|
|
|
|
, ffmpeg
|
|
|
|
, opusSupport ? true
|
|
|
|
, opusfile
|
|
|
|
, resampleSupport ? true
|
|
|
|
, soxr
|
|
|
|
, sslSupport ? true
|
|
|
|
, openssl
|
2023-05-24 13:37:59 +00:00
|
|
|
, portaudioSupport ? stdenv.isDarwin
|
|
|
|
, portaudio
|
2024-01-02 11:29:13 +00:00
|
|
|
, slimserver
|
2023-05-24 13:37:59 +00:00
|
|
|
, AudioToolbox
|
|
|
|
, AudioUnit
|
|
|
|
, Carbon
|
|
|
|
, CoreAudio
|
|
|
|
, CoreVideo
|
|
|
|
, VideoDecodeAcceleration
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-05-24 13:37:59 +00:00
|
|
|
inherit (lib) optional optionals optionalString;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
pulseSupport = audioBackend == "pulse";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
binName = "squeezelite${optionalString pulseSupport "-pulse"}";
|
|
|
|
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
# the nixos module uses the pname as the binary name
|
|
|
|
pname = binName;
|
2020-04-24 23:36:52 +00:00
|
|
|
# versions are specified in `squeezelite.h`
|
|
|
|
# see https://github.com/ralph-irving/squeezelite/issues/29
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.9.9.1449";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-03-30 09:31:56 +00:00
|
|
|
owner = "ralph-irving";
|
|
|
|
repo = "squeezelite";
|
2023-10-09 19:29:22 +00:00
|
|
|
rev = "8581aba8b1b67af272b89b62a7a9b56082307ab6";
|
|
|
|
hash = "sha256-/qyoc0/7Q8yiu5AhuLQFUiE88wf+/ejHjSucjpoN5bI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
buildInputs = [ flac libmad libvorbis mpg123 ]
|
2023-05-24 13:37:59 +00:00
|
|
|
++ optional pulseSupport libpulseaudio
|
|
|
|
++ optional alsaSupport alsa-lib
|
|
|
|
++ optional portaudioSupport portaudio
|
|
|
|
++ optionals stdenv.isDarwin [ CoreVideo VideoDecodeAcceleration CoreAudio AudioToolbox AudioUnit Carbon ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional faad2Support faad2
|
2021-05-20 23:08:51 +00:00
|
|
|
++ optional ffmpegSupport ffmpeg
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional opusSupport opusfile
|
|
|
|
++ optional resampleSupport soxr
|
|
|
|
++ optional sslSupport openssl;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace opus.c \
|
|
|
|
--replace "<opusfile.h>" "<opus/opusfile.h>"
|
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
EXECUTABLE = binName;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
OPTS = [ "-DLINKALL" "-DGPIO" ]
|
2022-03-30 09:31:56 +00:00
|
|
|
++ optional dsdSupport "-DDSD"
|
|
|
|
++ optional (!faad2Support) "-DNO_FAAD"
|
|
|
|
++ optional ffmpegSupport "-DFFMPEG"
|
|
|
|
++ optional opusSupport "-DOPUS"
|
2023-05-24 13:37:59 +00:00
|
|
|
++ optional portaudioSupport "-DPORTAUDIO"
|
2022-03-30 09:31:56 +00:00
|
|
|
++ optional pulseSupport "-DPULSEAUDIO"
|
|
|
|
++ optional resampleSupport "-DRESAMPLE"
|
|
|
|
++ optional sslSupport "-DUSE_SSL";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
env = lib.optionalAttrs stdenv.isDarwin {
|
|
|
|
LDADD = "-lportaudio -lpthread";
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
install -Dm555 -t $out/bin ${binName}
|
|
|
|
install -Dm444 -t $out/share/doc/squeezelite *.txt *.md
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
passthru = {
|
|
|
|
inherit (slimserver) tests;
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Lightweight headless squeezebox client emulator";
|
|
|
|
homepage = "https://github.com/ralph-irving/squeezelite";
|
2022-03-30 09:31:56 +00:00
|
|
|
license = with licenses; [ gpl3Plus ] ++ optional dsdSupport bsd2;
|
2023-10-19 13:55:26 +00:00
|
|
|
mainProgram = binName;
|
2022-11-04 12:27:35 +00:00
|
|
|
maintainers = with maintainers; [ adamcstephens ];
|
2023-05-24 13:37:59 +00:00
|
|
|
platforms = if (audioBackend == "pulse") then platforms.linux else platforms.linux ++ platforms.darwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|