2021-09-05 15:15:31 +00:00
|
|
|
{ lib
|
2023-05-20 18:48:33 +00:00
|
|
|
, stdenv
|
2021-09-05 15:15:31 +00:00
|
|
|
, bash
|
2023-05-20 18:48:33 +00:00
|
|
|
, buildNpmPackage
|
2021-09-05 15:15:31 +00:00
|
|
|
, fetchFromGitHub
|
2023-05-20 18:48:33 +00:00
|
|
|
, installShellFiles
|
2021-09-05 15:15:31 +00:00
|
|
|
, makeWrapper
|
2023-05-20 18:48:33 +00:00
|
|
|
, nodejs
|
|
|
|
, substituteAll
|
2021-09-05 15:15:31 +00:00
|
|
|
, v4l-utils
|
2023-05-20 18:48:33 +00:00
|
|
|
, which
|
2021-09-05 15:15:31 +00:00
|
|
|
}:
|
|
|
|
|
2023-05-20 18:48:33 +00:00
|
|
|
buildNpmPackage rec {
|
2021-09-05 15:15:31 +00:00
|
|
|
pname = "mirakurun";
|
2023-05-20 18:48:33 +00:00
|
|
|
version = "3.9.0-rc.4";
|
2021-09-05 15:15:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Chinachu";
|
|
|
|
repo = "Mirakurun";
|
|
|
|
rev = version;
|
2023-05-20 18:48:33 +00:00
|
|
|
sha256 = "sha256-Qg+wET5H9t3Mv2Hv0iT/C85/SEaQ+BHSBL3JjMQW5+Q=";
|
2021-09-05 15:15:31 +00:00
|
|
|
};
|
|
|
|
|
2023-05-20 18:48:33 +00:00
|
|
|
patches = [
|
|
|
|
# NOTE: fixes for hardcoded paths and assumptions about filesystem
|
|
|
|
# permissions
|
|
|
|
./nix-filesystem.patch
|
|
|
|
];
|
2021-09-05 15:15:31 +00:00
|
|
|
|
2023-05-20 18:48:33 +00:00
|
|
|
npmDepsHash = "sha256-e7m7xb7p1SBzLAyQ82TTR/qLXv4lRm37x0JJPWYYGvI=";
|
2021-09-05 15:15:31 +00:00
|
|
|
|
2023-05-20 18:48:33 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
2021-09-05 15:15:31 +00:00
|
|
|
|
2023-05-20 18:48:33 +00:00
|
|
|
# workaround for https://github.com/webpack/webpack/issues/14532
|
|
|
|
NODE_OPTIONS = "--openssl-legacy-provider";
|
2021-09-05 15:15:31 +00:00
|
|
|
|
2023-05-20 18:48:33 +00:00
|
|
|
postInstall =
|
2021-09-05 15:15:31 +00:00
|
|
|
let
|
2023-05-20 18:48:33 +00:00
|
|
|
runtimeDeps = [
|
|
|
|
bash
|
|
|
|
nodejs
|
|
|
|
which
|
2024-09-24 15:50:49 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [ v4l-utils ];
|
2023-05-20 18:48:33 +00:00
|
|
|
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
|
|
|
|
''
|
2023-05-20 18:48:33 +00:00
|
|
|
sed 's/@DESCRIPTION@/${meta.description}/g' ${./mirakurun.1} > mirakurun.1
|
|
|
|
installManPage mirakurun.1
|
2021-09-05 15:15:31 +00:00
|
|
|
|
2023-05-20 18:48:33 +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.
|
2023-05-20 18:48:33 +00:00
|
|
|
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}
|
|
|
|
|
2023-05-20 18:48:33 +00:00
|
|
|
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; {
|
2023-05-20 18:48:33 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|