nixpkgs/pkgs/applications/audio/squeezelite/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

116 lines
3.0 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, flac
2024-01-08 03:08:41 +00:00
, libgpiod
, libmad
, libpulseaudio
, libvorbis
, mpg123
2023-05-17 15:45:45 +00:00
, audioBackend ? if stdenv.isLinux then "alsa" else "portaudio"
, alsaSupport ? stdenv.isLinux
, alsa-lib
, dsdSupport ? true
, faad2Support ? true
, faad2
, ffmpegSupport ? true
, ffmpeg
, opusSupport ? true
, opusfile
, resampleSupport ? true
, soxr
, sslSupport ? true
, openssl
2023-05-17 15:45:45 +00:00
, portaudioSupport ? stdenv.isDarwin
, portaudio
, slimserver
2023-05-17 15:45:45 +00:00
, AudioToolbox
, AudioUnit
, Carbon
, CoreAudio
, CoreVideo
, VideoDecodeAcceleration
}:
2016-06-11 12:45:24 +00:00
let
2023-05-17 15:45:45 +00:00
inherit (lib) optional optionals optionalString;
pulseSupport = audioBackend == "pulse";
binName = "squeezelite${optionalString pulseSupport "-pulse"}";
in
stdenv.mkDerivation {
# the nixos module uses the pname as the binary name
pname = binName;
# versions are specified in `squeezelite.h`
# see https://github.com/ralph-irving/squeezelite/issues/29
2024-03-22 20:19:10 +00:00
version = "2.0.0.1473";
2016-06-11 12:45:24 +00:00
src = fetchFromGitHub {
owner = "ralph-irving";
repo = "squeezelite";
2024-03-22 20:19:10 +00:00
rev = "66c9b6a21834019a0230c39fcee74b6bf2891f7d";
hash = "sha256-MCH7vltF3jLGfxcRspXg9eQMx+e+lHSoxIanf91NrE0=";
2016-06-11 12:45:24 +00:00
};
buildInputs = [ flac libmad libvorbis mpg123 ]
2023-05-17 15:45:45 +00:00
++ optional pulseSupport libpulseaudio
++ optional alsaSupport alsa-lib
++ optional portaudioSupport portaudio
++ optionals stdenv.isDarwin [ CoreVideo VideoDecodeAcceleration CoreAudio AudioToolbox AudioUnit Carbon ]
++ optional faad2Support faad2
++ optional ffmpegSupport ffmpeg
++ optional opusSupport opusfile
++ optional resampleSupport soxr
2024-01-08 03:08:41 +00:00
++ optional sslSupport openssl
++ optional (stdenv.isAarch32 or stdenv.isAarch64) libgpiod;
2016-06-11 12:45:24 +00:00
2018-03-29 08:58:09 +00:00
enableParallelBuilding = true;
postPatch = ''
substituteInPlace opus.c \
--replace "<opusfile.h>" "<opus/opusfile.h>"
'';
EXECUTABLE = binName;
2022-08-11 01:12:32 +00:00
OPTS = [ "-DLINKALL" "-DGPIO" ]
++ optional dsdSupport "-DDSD"
++ optional (!faad2Support) "-DNO_FAAD"
++ optional ffmpegSupport "-DFFMPEG"
++ optional opusSupport "-DOPUS"
2023-05-17 15:45:45 +00:00
++ optional portaudioSupport "-DPORTAUDIO"
++ optional pulseSupport "-DPULSEAUDIO"
++ optional resampleSupport "-DRESAMPLE"
2024-01-08 03:08:41 +00:00
++ optional sslSupport "-DUSE_SSL"
++ optional (stdenv.isAarch32 or stdenv.isAarch64) "-DRPI";
2023-05-21 23:17:00 +00:00
env = lib.optionalAttrs stdenv.isDarwin {
LDADD = "-lportaudio -lpthread";
};
2023-05-17 15:45:45 +00:00
2016-06-11 12:45:24 +00:00
installPhase = ''
2018-03-29 08:58:09 +00:00
runHook preInstall
install -Dm555 -t $out/bin ${binName}
install -Dm444 -t $out/share/doc/squeezelite *.txt *.md
2018-03-29 08:58:09 +00:00
runHook postInstall
2016-06-11 12:45:24 +00:00
'';
passthru = {
inherit (slimserver) tests;
updateScript = ./update.sh;
};
2023-04-05 22:46:07 +00:00
meta = with lib; {
2016-06-11 12:45:24 +00:00
description = "Lightweight headless squeezebox client emulator";
homepage = "https://github.com/ralph-irving/squeezelite";
license = with licenses; [ gpl3Plus ] ++ optional dsdSupport bsd2;
2023-10-18 14:32:47 +00:00
mainProgram = binName;
2022-10-28 13:48:07 +00:00
maintainers = with maintainers; [ adamcstephens ];
2023-05-17 15:45:45 +00:00
platforms = if (audioBackend == "pulse") then platforms.linux else platforms.linux ++ platforms.darwin;
2016-06-11 12:45:24 +00:00
};
}