vuls: init at 0.27.0 (#348530)
[NixPkgs.git] / pkgs / by-name / sl / slimserver / package.nix
blobabdb045e7ceddc24bc38bfa861351574db39eafb
2   faad2,
3   fetchFromGitHub,
4   flac,
5   lame,
6   lib,
7   makeWrapper,
8   monkeysAudio,
9   nixosTests,
10   perlPackages,
11   sox,
12   stdenv,
13   wavpack,
14   zlib,
15   enableUnfreeFirmware ? false,
18 let
19   binPath = lib.makeBinPath (
20     [
21       lame
22       flac
23       faad2
24       sox
25       wavpack
26     ]
27     ++ (lib.optional stdenv.hostPlatform.isLinux monkeysAudio)
28   );
29   libPath = lib.makeLibraryPath [
30     zlib
31     stdenv.cc.cc.lib
32   ];
34 perlPackages.buildPerlPackage rec {
35   pname = "slimserver";
36   version = "8.5.2";
38   src = fetchFromGitHub {
39     owner = "LMS-Community";
40     repo = "slimserver";
41     rev = version;
42     hash = "sha256-262SHaxt5ow3nJtNVk10sbiPUfDb/U+Ab97DRjkJZFI=";
43   };
45   nativeBuildInputs = [ makeWrapper ];
47   buildInputs =
48     with perlPackages;
49     [
50       AnyEvent
51       ArchiveZip
52       AsyncUtil
53       AudioScan
54       CarpClan
55       CGI
56       ClassAccessor
57       ClassAccessorChained
58       ClassC3
59       # ClassC3Componentised # Error: DBIx::Class::Row::throw_exception(): DBIx::Class::Relationship::BelongsTo::belongs_to(): Can't infer join condition for track
60       ClassDataInheritable
61       ClassInspector
62       ClassISA
63       ClassMember
64       ClassSingleton
65       ClassVirtual
66       ClassXSAccessor
67       CompressRawZlib
68       CryptOpenSSLRSA
69       DataDump
70       DataPage
71       DataURIEncode
72       DBDSQLite
73       DBI
74       # DBIxClass # https://github.com/LMS-Community/slimserver/issues/138
75       DigestSHA1
76       EncodeDetect
77       EV
78       ExporterLite
79       FileBOM
80       FileCopyRecursive
81       # FileNext # https://github.com/LMS-Community/slimserver/pull/1140
82       FileReadBackwards
83       FileSlurp
84       FileWhich
85       HTMLParser
86       HTTPCookies
87       HTTPDaemon
88       HTTPMessage
89       ImageScale
90       IOAIO
91       IOInterface
92       IOSocketSSL
93       IOString
94       JSONXS
95       JSONXSVersionOneAndTwo
96       # LogLog4perl # Internal error: Root Logger not initialized.
97       LWP
98       LWPProtocolHttps
99       MP3CutGapless
100       NetHTTP
101       NetHTTPSNB
102       PathClass
103       ProcBackground
104       # SQLAbstract # DBI Exception: DBD::SQLite::db prepare_cached failed: no such function: ARRAY
105       SQLAbstractLimit
106       SubName
107       TemplateToolkit
108       TextUnidecode
109       TieCacheLRU
110       TieCacheLRUExpires
111       TieRegexpHash
112       TimeDate
113       URI
114       URIFind
115       UUIDTiny
116       XMLParser
117       XMLSimple
118       YAMLLibYAML
119     ]
120     # ++ (lib.optional stdenv.hostPlatform.isDarwin perlPackages.MacFSEvents)
121     ++ (lib.optional stdenv.hostPlatform.isLinux perlPackages.LinuxInotify2);
123   prePatch = ''
124     # remove vendored binaries
125     rm -rf Bin
127     # remove most vendored modules, keeping necessary ones
128     mkdir -p CPAN_used/Class/C3/ CPAN_used/SQL/ CPAN_used/File/
129     rm -r CPAN/SQL/Abstract/Limit.pm
130     cp -rv CPAN/Class/C3/Componentised.pm CPAN_used/Class/C3/
131     cp -rv CPAN/DBIx CPAN_used/
132     cp -rv CPAN/File/Next.pm CPAN_used/File/
133     cp -rv CPAN/Log CPAN_used/
134     cp -rv CPAN/SQL/* CPAN_used/SQL/
135     rm -r CPAN
136     mv CPAN_used CPAN
138     # another set of vendored/modified modules exist in lib, more selectively cleaned for now
139     rm -rf lib/Audio
141     ${lib.optionalString (!enableUnfreeFirmware) ''
142       # remove unfree firmware
143       rm -rf Firmware
144     ''}
146     touch Makefile.PL
147   '';
149   doCheck = false;
151   installPhase = ''
152     cp -r . $out
153     wrapProgram $out/slimserver.pl --prefix LD_LIBRARY_PATH : "${libPath}" --prefix PATH : "${binPath}"
154     wrapProgram $out/scanner.pl --prefix LD_LIBRARY_PATH : "${libPath}" --prefix PATH : "${binPath}"
155     mkdir $out/bin
156     ln -s $out/slimserver.pl $out/bin/slimserver
157   '';
159   outputs = [ "out" ];
161   passthru = {
162     tests = {
163       inherit (nixosTests) slimserver;
164     };
166     updateScript = ./update.nu;
167   };
169   meta = with lib; {
170     homepage = "https://lyrion.org/";
171     changelog = "https://github.com/LMS-Community/slimserver/blob/${version}/Changelog${lib.versions.major version}.html";
172     description = "Lyrion Music Server (formerly Logitech Media Server) is open-source server software which controls a wide range of Squeezebox audio players";
173     # the firmware is not under a free license, so we do not include firmware in the default package
174     # https://github.com/LMS-Community/slimserver/blob/public/8.3/License.txt
175     license = if enableUnfreeFirmware then licenses.unfree else licenses.gpl2Only;
176     mainProgram = "slimserver";
177     maintainers = with maintainers; [
178       adamcstephens
179       jecaro
180     ];
181     platforms = platforms.unix;
182     broken = stdenv.hostPlatform.isDarwin;
183   };