nixpkgs/pkgs/by-name/sq/squeezelite/package.nix

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

130 lines
3.1 KiB
Nix
Raw Normal View History

2024-05-24 22:04:10 +03:00
{
lib,
stdenv,
darwin,
fetchFromGitHub,
flac,
libgpiod,
libmad,
libpulseaudio,
libvorbis,
mpg123,
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,
portaudioSupport ? stdenv.isDarwin,
portaudio,
slimserver,
}:
2016-06-11 15:45:24 +03:00
let
2023-05-17 18:45:45 +03: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-05-12 18:22:36 +03:00
version = "2.0.0.1488";
2016-06-11 15:45:24 +03:00
src = fetchFromGitHub {
owner = "ralph-irving";
repo = "squeezelite";
2024-05-12 18:22:36 +03:00
rev = "0e85ddfd79337cdc30b7d29922b1d790600bb6b4";
hash = "sha256-FGqo/c74JN000w/iRnvYUejqnYGDzHNZu9pEmR7yR3s=";
2016-06-11 15:45:24 +03:00
};
2024-05-24 22:04:10 +03:00
buildInputs =
[
flac
libmad
libvorbis
mpg123
]
2023-05-17 18:45:45 +03:00
++ optional pulseSupport libpulseaudio
++ optional alsaSupport alsa-lib
++ optional portaudioSupport portaudio
2024-05-24 22:04:10 +03:00
++ optionals stdenv.isDarwin (
with darwin.apple_sdk_11_0.frameworks;
[
CoreVideo
VideoDecodeAcceleration
CoreAudio
AudioToolbox
AudioUnit
Carbon
]
)
++ optional faad2Support faad2
++ optional ffmpegSupport ffmpeg
++ optional opusSupport opusfile
++ optional resampleSupport soxr
2024-01-08 06:08:41 +03:00
++ optional sslSupport openssl
++ optional (stdenv.isAarch32 or stdenv.isAarch64) libgpiod;
2016-06-11 15:45:24 +03:00
2018-03-29 11:58:09 +03:00
enableParallelBuilding = true;
postPatch = ''
substituteInPlace opus.c \
--replace "<opusfile.h>" "<opus/opusfile.h>"
'';
EXECUTABLE = binName;
2024-05-24 22:04:10 +03:00
OPTS =
[
"-DLINKALL"
"-DGPIO"
]
++ optional dsdSupport "-DDSD"
++ optional (!faad2Support) "-DNO_FAAD"
++ optional ffmpegSupport "-DFFMPEG"
++ optional opusSupport "-DOPUS"
2023-05-17 18:45:45 +03:00
++ optional portaudioSupport "-DPORTAUDIO"
++ optional pulseSupport "-DPULSEAUDIO"
++ optional resampleSupport "-DRESAMPLE"
2024-01-08 06:08:41 +03:00
++ optional sslSupport "-DUSE_SSL"
++ optional (stdenv.isAarch32 or stdenv.isAarch64) "-DRPI";
2024-05-24 22:04:10 +03:00
env = lib.optionalAttrs stdenv.isDarwin { LDADD = "-lportaudio -lpthread"; };
2023-05-17 18:45:45 +03:00
2016-06-11 15:45:24 +03:00
installPhase = ''
2018-03-29 11:58:09 +03:00
runHook preInstall
install -Dm555 -t $out/bin ${binName}
install -Dm444 -t $out/share/man/man1 doc/squeezelite.1
2018-03-29 11:58:09 +03:00
runHook postInstall
2016-06-11 15:45:24 +03:00
'';
passthru = {
inherit (slimserver) tests;
updateScript = ./update.sh;
};
2023-04-06 01:46:07 +03:00
meta = with lib; {
2016-06-11 15:45:24 +03:00
description = "Lightweight headless squeezebox client emulator";
homepage = "https://github.com/ralph-irving/squeezelite";
license = with licenses; [ gpl3Plus ] ++ optional dsdSupport bsd2;
2023-10-18 17:32:47 +03:00
mainProgram = binName;
2022-10-28 16:48:07 +03:00
maintainers = with maintainers; [ adamcstephens ];
2024-05-24 22:04:10 +03:00
platforms =
if (audioBackend == "pulse") then platforms.linux else platforms.linux ++ platforms.darwin;
2016-06-11 15:45:24 +03:00
};
}