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

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

89 lines
2.1 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, alsa-lib
, flac
, libmad
, libpulseaudio
, libvorbis
, mpg123
, audioBackend ? "alsa"
, dsdSupport ? true
, faad2Support ? true
, faad2
, ffmpegSupport ? true
, ffmpeg
, opusSupport ? true
, opusfile
, resampleSupport ? true
, soxr
, sslSupport ? true
, openssl
}:
2016-06-11 14:45:24 +02:00
let
inherit (lib) optional 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
2022-10-27 23:07:12 +02:00
version = "1.9.9.1411";
2016-06-11 14:45:24 +02:00
src = fetchFromGitHub {
owner = "ralph-irving";
repo = "squeezelite";
2022-10-27 23:07:12 +02:00
rev = "ca44fc6e258bb413d6281d927063b25940f42e5c";
hash = "sha256-aZ+2nyy6tK3VwgTCWGoNaU4//kkHUzd6DZSfTEIgbvY=";
2016-06-11 14:45:24 +02:00
};
buildInputs = [ flac libmad libvorbis mpg123 ]
++ lib.singleton (if pulseSupport then libpulseaudio else alsa-lib)
++ optional faad2Support faad2
++ optional ffmpegSupport ffmpeg
++ optional opusSupport opusfile
++ optional resampleSupport soxr
++ optional sslSupport openssl;
2016-06-11 14:45:24 +02:00
2018-03-29 10:58:09 +02:00
enableParallelBuilding = true;
postPatch = ''
substituteInPlace opus.c \
--replace "<opusfile.h>" "<opus/opusfile.h>"
'';
EXECUTABLE = binName;
OPTS = [ "-DLINKALL" ]
++ optional dsdSupport "-DDSD"
++ optional (!faad2Support) "-DNO_FAAD"
++ optional ffmpegSupport "-DFFMPEG"
++ optional opusSupport "-DOPUS"
++ optional pulseSupport "-DPULSEAUDIO"
++ optional resampleSupport "-DRESAMPLE"
++ optional sslSupport "-DUSE_SSL";
2016-06-11 14:45:24 +02:00
installPhase = ''
2018-03-29 10:58:09 +02:00
runHook preInstall
install -Dm555 -t $out/bin ${binName}
install -Dm444 -t $out/share/doc/squeezelite *.txt *.md
2018-03-29 10:58:09 +02:00
runHook postInstall
2016-06-11 14:45:24 +02:00
'';
meta = with lib; {
2016-06-11 14:45:24 +02:00
description = "Lightweight headless squeezebox client emulator";
homepage = "https://github.com/ralph-irving/squeezelite";
license = with licenses; [ gpl3Plus ] ++ optional dsdSupport bsd2;
2022-10-28 15:48:07 +02:00
maintainers = with maintainers; [ adamcstephens ];
2016-06-11 14:45:24 +02:00
platforms = platforms.linux;
};
}