mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
130 lines
3.2 KiB
Nix
130 lines
3.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
darwin,
|
|
fetchFromGitHub,
|
|
flac,
|
|
libgpiod,
|
|
libmad,
|
|
libpulseaudio,
|
|
libvorbis,
|
|
mpg123,
|
|
audioBackend ? if stdenv.hostPlatform.isLinux then "alsa" else "portaudio",
|
|
alsaSupport ? stdenv.hostPlatform.isLinux,
|
|
alsa-lib,
|
|
dsdSupport ? true,
|
|
faad2Support ? true,
|
|
faad2,
|
|
ffmpegSupport ? true,
|
|
ffmpeg,
|
|
opusSupport ? true,
|
|
opusfile,
|
|
resampleSupport ? true,
|
|
soxr,
|
|
sslSupport ? true,
|
|
openssl,
|
|
portaudioSupport ? stdenv.hostPlatform.isDarwin,
|
|
portaudio,
|
|
slimserver,
|
|
}:
|
|
|
|
let
|
|
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
|
|
version = "2.0.0.1488";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ralph-irving";
|
|
repo = "squeezelite";
|
|
rev = "0e85ddfd79337cdc30b7d29922b1d790600bb6b4";
|
|
hash = "sha256-FGqo/c74JN000w/iRnvYUejqnYGDzHNZu9pEmR7yR3s=";
|
|
};
|
|
|
|
buildInputs =
|
|
[
|
|
flac
|
|
libmad
|
|
libvorbis
|
|
mpg123
|
|
]
|
|
++ optional pulseSupport libpulseaudio
|
|
++ optional alsaSupport alsa-lib
|
|
++ optional portaudioSupport portaudio
|
|
++ optionals stdenv.hostPlatform.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
|
|
++ optional sslSupport openssl
|
|
++ optional (stdenv.hostPlatform.isAarch32 or stdenv.hostPlatform.isAarch64) libgpiod;
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
postPatch = ''
|
|
substituteInPlace opus.c \
|
|
--replace "<opusfile.h>" "<opus/opusfile.h>"
|
|
'';
|
|
|
|
EXECUTABLE = binName;
|
|
|
|
OPTS =
|
|
[
|
|
"-DLINKALL"
|
|
"-DGPIO"
|
|
]
|
|
++ optional dsdSupport "-DDSD"
|
|
++ optional (!faad2Support) "-DNO_FAAD"
|
|
++ optional ffmpegSupport "-DFFMPEG"
|
|
++ optional opusSupport "-DOPUS"
|
|
++ optional portaudioSupport "-DPORTAUDIO"
|
|
++ optional pulseSupport "-DPULSEAUDIO"
|
|
++ optional resampleSupport "-DRESAMPLE"
|
|
++ optional sslSupport "-DUSE_SSL"
|
|
++ optional (stdenv.hostPlatform.isAarch32 or stdenv.hostPlatform.isAarch64) "-DRPI";
|
|
|
|
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { LDADD = "-lportaudio -lpthread"; };
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -Dm555 -t $out/bin ${binName}
|
|
install -Dm444 -t $out/share/man/man1 doc/squeezelite.1
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru = {
|
|
inherit (slimserver) tests;
|
|
updateScript = ./update.sh;
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Lightweight headless squeezebox client emulator";
|
|
homepage = "https://github.com/ralph-irving/squeezelite";
|
|
license = with licenses; [ gpl3Plus ] ++ optional dsdSupport bsd2;
|
|
mainProgram = binName;
|
|
maintainers = with maintainers; [ adamcstephens ];
|
|
platforms =
|
|
if (audioBackend == "pulse") then platforms.linux else platforms.linux ++ platforms.darwin;
|
|
};
|
|
}
|