nixpkgs/pkgs/applications/video/mirakurun/default.nix

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

76 lines
2.0 KiB
Nix
Raw Normal View History

2021-09-05 15:15:31 +00:00
{ lib
, stdenv
2021-09-05 15:15:31 +00:00
, bash
, buildNpmPackage
2021-09-05 15:15:31 +00:00
, fetchFromGitHub
, installShellFiles
2021-09-05 15:15:31 +00:00
, makeWrapper
, nodejs
, substituteAll
2021-09-05 15:15:31 +00:00
, v4l-utils
, which
2021-09-05 15:15:31 +00:00
}:
buildNpmPackage rec {
2021-09-05 15:15:31 +00:00
pname = "mirakurun";
version = "3.9.0-rc.4";
2021-09-05 15:15:31 +00:00
src = fetchFromGitHub {
owner = "Chinachu";
repo = "Mirakurun";
rev = version;
sha256 = "sha256-Qg+wET5H9t3Mv2Hv0iT/C85/SEaQ+BHSBL3JjMQW5+Q=";
2021-09-05 15:15:31 +00:00
};
patches = [
# NOTE: fixes for hardcoded paths and assumptions about filesystem
# permissions
./nix-filesystem.patch
];
2021-09-05 15:15:31 +00:00
npmDepsHash = "sha256-e7m7xb7p1SBzLAyQ82TTR/qLXv4lRm37x0JJPWYYGvI=";
2021-09-05 15:15:31 +00:00
nativeBuildInputs = [ installShellFiles makeWrapper ];
2021-09-05 15:15:31 +00:00
# workaround for https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS = "--openssl-legacy-provider";
2021-09-05 15:15:31 +00:00
postInstall =
2021-09-05 15:15:31 +00:00
let
runtimeDeps = [
bash
nodejs
which
] ++ lib.optionals stdenv.hostPlatform.isLinux [ v4l-utils ];
crc32Patch = substituteAll {
src = ./fix-musl-detection.patch;
isMusl = if stdenv.hostPlatform.isMusl then "true" else "false";
};
2021-09-05 15:15:31 +00:00
in
''
sed 's/@DESCRIPTION@/${meta.description}/g' ${./mirakurun.1} > mirakurun.1
installManPage mirakurun.1
2021-09-05 15:15:31 +00:00
wrapProgram $out/bin/mirakurun-epgdump \
2021-09-05 15:15:31 +00:00
--prefix PATH : ${lib.makeBinPath runtimeDeps}
# XXX: The original mirakurun command uses PM2 to manage the Mirakurun
# server. However, we invoke the server directly and let systemd
# manage it to avoid complication. This is okay since no features
# unique to PM2 is currently being used.
makeWrapper ${nodejs}/bin/npm $out/bin/mirakurun \
--chdir "$out/lib/node_modules/mirakurun" \
2021-09-05 15:15:31 +00:00
--prefix PATH : ${lib.makeBinPath runtimeDeps}
pushd $out/lib/node_modules/mirakurun/node_modules/@node-rs/crc32
patch -p3 < ${crc32Patch}
popd
'';
2021-09-05 15:15:31 +00:00
2023-02-11 20:16:22 +00:00
meta = with lib; {
description = "Resource manager for TV tuners.";
2023-02-11 20:16:22 +00:00
license = licenses.asl20;
maintainers = with maintainers; [ midchildan ];
2021-09-05 15:15:31 +00:00
};
}