nixpkgs-suyu/pkgs/servers/gerbera/default.nix

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

115 lines
3 KiB
Nix
Raw Normal View History

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