nixpkgs/pkgs/servers/slimserver/default.nix

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

158 lines
3.6 KiB
Nix
Raw Normal View History

{ faad2
2021-09-19 13:27:29 +00:00
, fetchFromGitHub
, flac
, lame
, lib
, makeWrapper
2021-09-19 13:27:29 +00:00
, monkeysAudio
2023-11-05 01:43:15 +00:00
, nixosTests
, perl538Packages
, sox
, stdenv
2021-09-19 13:27:29 +00:00
, wavpack
, zlib
, enableUnfreeFirmware ? false
2021-09-19 13:27:29 +00:00
}:
2017-03-02 19:38:06 +00:00
2023-11-05 01:40:30 +00:00
let
perlPackages = perl538Packages;
2023-11-05 01:40:30 +00:00
in
perlPackages.buildPerlPackage rec {
pname = "slimserver";
version = "8.3.1";
2017-03-02 19:38:06 +00:00
2021-09-19 13:27:29 +00:00
src = fetchFromGitHub {
owner = "Logitech";
repo = "slimserver";
rev = version;
hash = "sha256-yMFOwh/oPiJnUsKWBGvd/GZLjkWocMAUK0r+Hx/SUPo=";
2017-03-02 19:38:06 +00:00
};
nativeBuildInputs = [ makeWrapper ];
2017-03-02 19:38:06 +00:00
buildInputs = with perlPackages; [
AnyEvent
ArchiveZip
AsyncUtil
AudioScan
CarpClan
CGI
ClassAccessor
ClassAccessorChained
ClassC3
# ClassC3Componentised # Error: DBIx::Class::Row::throw_exception(): DBIx::Class::Relationship::BelongsTo::belongs_to(): Can't infer join condition for track
ClassDataInheritable
ClassInspector
ClassISA
ClassMember
ClassSingleton
ClassVirtual
ClassXSAccessor
CompressRawZlib
CryptOpenSSLRSA
DataDump
DataPage
DataURIEncode
DBDSQLite
DBI
# DBIxClass # https://github.com/Logitech/slimserver/issues/138
DigestSHA1
EncodeDetect
EV
ExporterLite
FileBOM
FileCopyRecursive
FileNext
FileReadBackwards
FileSlurp
FileWhich
HTMLParser
HTTPCookies
HTTPDaemon
HTTPMessage
ImageScale
IOAIO
IOInterface
IOSocketSSL
IOString
JSONXS
JSONXSVersionOneAndTwo
# LogLog4perl # Internal error: Root Logger not initialized.
LWP
LWPProtocolHttps
MP3CutGapless
NetHTTP
NetHTTPSNB
PathClass
ProcBackground
# SQLAbstract # DBI Exception: DBD::SQLite::db prepare_cached failed: no such function: ARRAY
SQLAbstractLimit
SubName
TemplateToolkit
TextUnidecode
TieCacheLRU
TieCacheLRUExpires
TieRegexpHash
TimeDate
URI
URIFind
UUIDTiny
XMLParser
XMLSimple
YAMLLibYAML
]
# ++ (lib.optional stdenv.isDarwin perlPackages.MacFSEvents)
++ (lib.optional stdenv.isLinux perlPackages.LinuxInotify2);
prePatch = ''
# remove vendored binaries
rm -rf Bin
# remove most vendored modules, keeping necessary ones
mkdir -p CPAN_used/Class/C3/ CPAN_used/SQL
rm -r CPAN/SQL/Abstract/Limit.pm
cp -rv CPAN/Class/C3/Componentised.pm CPAN_used/Class/C3/
cp -rv CPAN/DBIx CPAN_used/
cp -rv CPAN/Log CPAN_used/
cp -rv CPAN/SQL/* CPAN_used/SQL/
rm -r CPAN
mv CPAN_used CPAN
${lib.optionalString (!enableUnfreeFirmware) ''
# remove unfree firmware
rm -rf Firmware
''}
touch Makefile.PL
2018-05-19 08:20:00 +00:00
'';
doCheck = false;
2017-03-02 19:38:06 +00:00
installPhase = ''
cp -r . $out
2018-05-19 08:20:00 +00:00
wrapProgram $out/slimserver.pl \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib stdenv.cc.cc.lib ]}" \
2023-11-05 02:21:10 +00:00
--prefix PATH : "${lib.makeBinPath ([ lame flac faad2 sox wavpack ] ++ (lib.optional stdenv.isLinux monkeysAudio))}"
mkdir $out/bin
ln -s $out/slimserver.pl $out/bin/slimserver
2017-03-02 19:38:06 +00:00
'';
outputs = [ "out" ];
2017-03-02 19:38:06 +00:00
2023-11-05 01:43:15 +00:00
passthru.tests = {
inherit (nixosTests) slimserver;
};
meta = with lib; {
homepage = "https://github.com/Logitech/slimserver";
2017-03-02 19:38:06 +00:00
description = "Server for Logitech Squeezebox players. This server is also called Logitech Media Server";
# the firmware is not under a free license, but not included in the default package
# https://github.com/Logitech/slimserver/blob/public/8.3/License.txt
license = if enableUnfreeFirmware then licenses.unfree else licenses.gpl2Only;
mainProgram = "slimserver";
maintainers = with maintainers; [ adamcstephens jecaro ];
platforms = platforms.unix;
2023-11-05 02:21:10 +00:00
broken = stdenv.isDarwin;
2017-03-02 19:38:06 +00:00
};
}