1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-01 18:12:46 +00:00
nixpkgs/pkgs/servers/gerbera/default.nix

114 lines
2.9 KiB
Nix
Raw Normal View History

2021-05-14 10:04:19 +01:00
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
# required
, fmt
, 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-07-16 07:10:59 +01:00
}:
let
2021-05-14 10:04:19 +01: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-07-16 07:10:59 +01:00
pname = "gerbera";
2021-05-14 10:04:19 +01:00
version = "1.8.1";
2020-07-16 07:10:59 +01:00
src = fetchFromGitHub {
repo = "gerbera";
owner = "gerbera";
rev = "v${version}";
2021-05-14 10:04:19 +01:00
sha256 = "sha256-bJIT/qQOKTy2l0wsumlGNvaGqzb2mK0hHKG0S6mEG3o=";
2020-07-16 07:10:59 +01:00
};
2021-05-14 10:04:19 +01: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-07-16 07:10:59 +01:00
cmakeFlags = [
# systemd service will be generated alongside the service
"-DWITH_SYSTEMD=OFF"
2021-05-14 10:04:19 +01:00
] ++ map (e: "-DWITH_${e.name}=${if e.enable then "ON" else "OFF"}") options;
2020-07-16 07:10:59 +01:00
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [
2021-05-14 10:04:19 +01:00
fmt
libiconv
libupnp'
libuuid
pugixml
2020-07-16 07:10:59 +01:00
spdlog
2021-05-14 10:04:19 +01:00
sqlite
zlib
] ++ flatten (builtins.catAttrs "packages" (builtins.filter (e: e.enable) options));
2020-07-16 07:10:59 +01:00
meta = with lib; {
2020-10-18 10:03:52 +01:00
homepage = "https://docs.gerbera.io/";
2020-07-16 07:10:59 +01: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-14 10:04:19 +01:00
license = licenses.gpl2Only;
maintainers = with maintainers; [ ardumont ];
2020-07-16 07:10:59 +01:00
platforms = platforms.linux;
};
}