2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
2022-01-25 03:21:06 +00:00
|
|
|
, nixosTests
|
2021-05-20 23:08:51 +00:00
|
|
|
# required
|
|
|
|
, libiconv
|
|
|
|
, libupnp
|
|
|
|
, libuuid
|
|
|
|
, pugixml
|
|
|
|
, spdlog
|
|
|
|
, sqlite
|
|
|
|
, zlib
|
|
|
|
# options
|
|
|
|
, enableMysql ? false
|
|
|
|
, libmysqlclient
|
|
|
|
, enableDuktape ? true
|
|
|
|
, duktape
|
|
|
|
, enableCurl ? true
|
|
|
|
, curl
|
|
|
|
, enableTaglib ? true
|
|
|
|
, taglib
|
|
|
|
, enableLibmagic ? true
|
|
|
|
, file
|
|
|
|
, enableLibmatroska ? true
|
|
|
|
, libmatroska
|
|
|
|
, libebml
|
|
|
|
, enableAvcodec ? false
|
|
|
|
, ffmpeg
|
|
|
|
, enableLibexif ? true
|
|
|
|
, libexif
|
|
|
|
, enableExiv2 ? false
|
|
|
|
, exiv2
|
|
|
|
, enableFFmpegThumbnailer ? false
|
|
|
|
, ffmpegthumbnailer
|
|
|
|
, enableInotifyTools ? true
|
|
|
|
, inotify-tools
|
2020-10-07 09:15:18 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-05-20 23:08:51 +00:00
|
|
|
libupnp' = libupnp.overrideAttrs (super: rec {
|
|
|
|
cmakeFlags = super.cmakeFlags or [ ] ++ [
|
|
|
|
"-Dblocking_tcp_connections=OFF"
|
|
|
|
"-Dreuseaddr=ON"
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
|
|
|
options = [
|
|
|
|
{ name = "AVCODEC"; enable = enableAvcodec; packages = [ ffmpeg ]; }
|
|
|
|
{ name = "CURL"; enable = enableCurl; packages = [ curl ]; }
|
|
|
|
{ name = "EXIF"; enable = enableLibexif; packages = [ libexif ]; }
|
|
|
|
{ name = "EXIV2"; enable = enableExiv2; packages = [ exiv2 ]; }
|
|
|
|
{ name = "FFMPEGTHUMBNAILER"; enable = enableFFmpegThumbnailer; packages = [ ffmpegthumbnailer ]; }
|
|
|
|
{ name = "INOTIFY"; enable = enableInotifyTools; packages = [ inotify-tools ]; }
|
|
|
|
{ name = "JS"; enable = enableDuktape; packages = [ duktape ]; }
|
|
|
|
{ name = "MAGIC"; enable = enableLibmagic; packages = [ file ]; }
|
|
|
|
{ name = "MATROSKA"; enable = enableLibmatroska; packages = [ libmatroska libebml ]; }
|
|
|
|
{ name = "MYSQL"; enable = enableMysql; packages = [ libmysqlclient ]; }
|
|
|
|
{ name = "TAGLIB"; enable = enableTaglib; packages = [ taglib ]; }
|
|
|
|
];
|
|
|
|
|
|
|
|
inherit (lib) flatten optionals;
|
|
|
|
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-10-07 09:15:18 +00:00
|
|
|
pname = "gerbera";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "1.10.0";
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
repo = "gerbera";
|
|
|
|
owner = "gerbera";
|
|
|
|
rev = "v${version}";
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "sha256-z/w0/iuZ0GIYmDWUmqK+1l3GNNFWhkZCWqXhvjgLjgY=";
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postPatch = lib.optionalString enableMysql ''
|
|
|
|
substituteInPlace cmake/FindMySQL.cmake \
|
|
|
|
--replace /usr/include/mysql ${lib.getDev libmysqlclient}/include/mariadb \
|
|
|
|
--replace /usr/lib/mysql ${lib.getLib libmysqlclient}/lib/mariadb
|
|
|
|
'';
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
# systemd service will be generated alongside the service
|
|
|
|
"-DWITH_SYSTEMD=OFF"
|
2021-05-20 23:08:51 +00:00
|
|
|
] ++ map (e: "-DWITH_${e.name}=${if e.enable then "ON" else "OFF"}") options;
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-05-20 23:08:51 +00:00
|
|
|
libiconv
|
|
|
|
libupnp'
|
|
|
|
libuuid
|
|
|
|
pugixml
|
2020-10-07 09:15:18 +00:00
|
|
|
spdlog
|
2021-05-20 23:08:51 +00:00
|
|
|
sqlite
|
|
|
|
zlib
|
|
|
|
] ++ flatten (builtins.catAttrs "packages" (builtins.filter (e: e.enable) options));
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) mediatomb; };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-10-19 00:13:06 +00:00
|
|
|
homepage = "https://docs.gerbera.io/";
|
2020-10-07 09:15:18 +00:00
|
|
|
description = "UPnP Media Server for 2020";
|
|
|
|
longDescription = ''
|
|
|
|
Gerbera is a Mediatomb fork.
|
|
|
|
It allows to stream your digital media through your home network and consume it on all kinds
|
|
|
|
of UPnP supporting devices.
|
|
|
|
'';
|
2021-05-20 23:08:51 +00:00
|
|
|
license = licenses.gpl2Only;
|
|
|
|
maintainers = with maintainers; [ ardumont ];
|
2020-10-07 09:15:18 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|