forked from mirrors/nixpkgs
Merge pull request #233053 from midchildan/chore/epgstation/node18
epgstation: use node18 + other fixes
This commit is contained in:
commit
493c6d8505
|
@ -80,11 +80,11 @@ in
|
|||
options.services.epgstation = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc description);
|
||||
|
||||
package = lib.mkOption {
|
||||
default = pkgs.epgstation;
|
||||
type = lib.types.package;
|
||||
defaultText = lib.literalExpression "pkgs.epgstation";
|
||||
description = lib.mdDoc "epgstation package to use";
|
||||
package = lib.mkPackageOptionMD pkgs "epgstation" { };
|
||||
|
||||
ffmpeg = lib.mkPackageOptionMD pkgs "ffmpeg" {
|
||||
default = [ "ffmpeg-headless" ];
|
||||
example = "pkgs.ffmpeg-full";
|
||||
};
|
||||
|
||||
usePreconfiguredStreaming = lib.mkOption {
|
||||
|
@ -278,6 +278,8 @@ in
|
|||
package = lib.mkDefault pkgs.mariadb;
|
||||
ensureDatabases = [ cfg.database.name ];
|
||||
# FIXME: enable once mysqljs supports auth_socket
|
||||
# https://github.com/mysqljs/mysql/issues/1507
|
||||
#
|
||||
# ensureUsers = [ {
|
||||
# name = username;
|
||||
# ensurePermissions = { "${cfg.database.name}.*" = "ALL PRIVILEGES"; };
|
||||
|
@ -295,8 +297,8 @@ in
|
|||
database = cfg.database.name;
|
||||
};
|
||||
|
||||
ffmpeg = lib.mkDefault "${pkgs.ffmpeg-full}/bin/ffmpeg";
|
||||
ffprobe = lib.mkDefault "${pkgs.ffmpeg-full}/bin/ffprobe";
|
||||
ffmpeg = lib.mkDefault "${cfg.ffmpeg}/bin/ffmpeg";
|
||||
ffprobe = lib.mkDefault "${cfg.ffmpeg}/bin/ffprobe";
|
||||
|
||||
# for disambiguation with TypeScript files
|
||||
recordedFileExtension = lib.mkDefault ".m2ts";
|
||||
|
@ -308,9 +310,15 @@ in
|
|||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '/var/lib/epgstation/key' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/streamfiles' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/drop' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/recorded' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/thumbnail' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/db/subscribers' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/db/migrations/mysql' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/db/migrations/postgres' - ${username} ${groupname} - -"
|
||||
"d '/var/lib/epgstation/db/migrations/sqlite' - ${username} ${groupname} - -"
|
||||
];
|
||||
|
||||
systemd.services.epgstation = {
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
{
|
||||
"name": "epgstation-client",
|
||||
"version": "2.6.20",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint",
|
||||
"watch": "vue-cli-service build --watch --mode development"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "6.5.95",
|
||||
"aribb24.js": "1.8.8",
|
||||
"axios": "0.24.0",
|
||||
"eventemitter2": "6.4.5",
|
||||
"hls.js": "1.1.2",
|
||||
"inversify": "6.0.1",
|
||||
"json-stable-stringify": "1.0.1",
|
||||
"lodash": "4.17.21",
|
||||
"material-design-icons-iconfont": "6.1.1",
|
||||
"mpegts.js": "1.6.10",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"resize-observer-polyfill": "1.5.1",
|
||||
"roboto-fontface": "*",
|
||||
"smoothscroll-polyfill": "0.4.4",
|
||||
"socket.io-client": "4.3.2",
|
||||
"typeface-roboto": "1.1.13",
|
||||
"vue": "2.6.14",
|
||||
"vue-class-component": "7.2.6",
|
||||
"vue-property-decorator": "9.1.2",
|
||||
"vue-router": "3.5.3",
|
||||
"vuetify": "2.5.10",
|
||||
"vuetify-datetime-picker": "2.1.1",
|
||||
"@types/hls.js": "0.13.3",
|
||||
"@types/json-stable-stringify": "1.0.33",
|
||||
"@types/lodash": "4.14.178",
|
||||
"@types/smoothscroll-polyfill": "0.3.1",
|
||||
"@types/socket.io-client": "1.4.36",
|
||||
"@typescript-eslint/eslint-plugin": "4.33.0",
|
||||
"@typescript-eslint/parser": "4.33.0",
|
||||
"@vue/cli-plugin-eslint": "4.5.12",
|
||||
"@vue/cli-plugin-typescript": "4.5.13",
|
||||
"@vue/cli-plugin-vuex": "4.5.13",
|
||||
"@vue/cli-service": "4.5.13",
|
||||
"@vue/eslint-config-prettier": "6.0.0",
|
||||
"@vue/eslint-config-typescript": "7.0.0",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-plugin-prettier": "3.4.1",
|
||||
"eslint-plugin-vue": "7.20.0",
|
||||
"prettier": "2.4.1",
|
||||
"sass": "1.32.12",
|
||||
"sass-loader": "10.2.0",
|
||||
"typescript": "4.4.4",
|
||||
"vue-cli-plugin-vuetify": "2.4.3",
|
||||
"vue-template-compiler": "2.6.14",
|
||||
"vuetify-loader": "1.7.3"
|
||||
}
|
||||
}
|
|
@ -1,17 +1,19 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchpatch
|
||||
, fetchFromGitHub
|
||||
, buildNpmPackage
|
||||
, installShellFiles
|
||||
, makeWrapper
|
||||
, bash
|
||||
, nodejs
|
||||
, gzip
|
||||
, callPackage
|
||||
, python3
|
||||
}:
|
||||
|
||||
let
|
||||
# NOTE: use updateScript to bump the package version
|
||||
pname = "EPGStation";
|
||||
buildNpmPackage rec {
|
||||
pname = "epgstation";
|
||||
version = "2.6.20";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "l3tnun";
|
||||
repo = "EPGStation";
|
||||
|
@ -19,68 +21,73 @@ let
|
|||
sha256 = "K1cAvmqWEfS6EY4MKAtjXb388XLYHtouxNM70PWgFig=";
|
||||
};
|
||||
|
||||
client = nodejs.pkgs.epgstation-client.override (drv: {
|
||||
# This is set to false to keep devDependencies at build time. Build time
|
||||
# dependencies are pruned afterwards.
|
||||
production = false;
|
||||
patches = [
|
||||
./use-mysql-over-domain-socket.patch
|
||||
|
||||
meta = drv.meta // {
|
||||
inherit (nodejs.meta) platforms;
|
||||
};
|
||||
});
|
||||
# upgrade dependencies to make it compatible with node 18
|
||||
(fetchpatch {
|
||||
url = "https://github.com/midchildan/EPGStation/commit/5d6cad746b7d9b6d246adcdecf9c991b77c9d89e.patch";
|
||||
sha256 = "sha256-9a8VUjczlyQHVO7w9MYorPIZunAuBuif1HNmtp1yMk8=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/midchildan/EPGStation/commit/c948e833e485c2b7cb7fb33b953cca1e20de3a70.patch";
|
||||
sha256 = "sha256-nM6KkVRURuQFZLXZ2etLU1a1+BoaJnfjngo07TFbe58=";
|
||||
})
|
||||
];
|
||||
|
||||
server = nodejs.pkgs.epgstation.override (drv: {
|
||||
# NOTE: updateScript relies on version matching the src.
|
||||
inherit version src;
|
||||
npmDepsHash = "sha256-dohencRGuvc+vSoclLVn5iles4GOuTq26BrEVeJ4GC4=";
|
||||
npmBuildScript = "build-server";
|
||||
npmRootPath = "/lib/node_modules/epgstation";
|
||||
|
||||
# This is set to false to keep devDependencies at build time. Build time
|
||||
# dependencies are pruned afterwards.
|
||||
production = false;
|
||||
buildInputs = [ bash ];
|
||||
nativeBuildInputs = [ installShellFiles makeWrapper python3 ];
|
||||
|
||||
buildInputs = (drv.buildInputs or [ ]) ++ [ bash ];
|
||||
nativeBuildInputs = (drv.nativeBuildInputs or [ ]) ++ [
|
||||
makeWrapper
|
||||
];
|
||||
clientDir = buildNpmPackage {
|
||||
pname = "${pname}-client";
|
||||
inherit version src installPhase meta;
|
||||
|
||||
preRebuild = ''
|
||||
# Fix for OpenSSL compat with newer Node.js
|
||||
export NODE_OPTIONS=--openssl-legacy-provider
|
||||
npmDepsHash = "sha256-a/cDPABWI4lPxvSOI4D90O71A9lm8icPMak/g6DPYQY=";
|
||||
npmRootPath = "";
|
||||
|
||||
# Fix for not being able to connect to mysql using domain sockets.
|
||||
patch -p1 < ${./use-mysql-over-domain-socket.patch}
|
||||
sourceRoot = "source/client";
|
||||
NODE_OPTIONS = "--openssl-legacy-provider";
|
||||
};
|
||||
|
||||
# Workaround for https://github.com/svanderburg/node2nix/issues/275
|
||||
sed -i -e "s|#!/usr/bin/env node|#! ${nodejs}/bin/node|" node_modules/node-gyp-build/bin.js
|
||||
postBuild = ''
|
||||
rm -rf client
|
||||
cp -r ${clientDir} client
|
||||
'';
|
||||
|
||||
# Optional typeorm dependency that does not build on aarch64-linux
|
||||
rm -r node_modules/oracledb
|
||||
# installPhase is shared with clientDir
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
find . -name package-lock.json -delete
|
||||
'';
|
||||
npm prune --omit dev --no-save \
|
||||
$npmInstallFlags \
|
||||
"''${npmInstallFlagsArray[@]}" \
|
||||
$npmFlags \
|
||||
"''${npmFlagsArray[@]}"
|
||||
|
||||
postInstall = let
|
||||
mkdir -p $out$npmRootPath
|
||||
cp -r . $out$npmRootPath
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall =
|
||||
let
|
||||
runtimeDeps = [ nodejs bash ];
|
||||
in
|
||||
''
|
||||
mkdir -p $out/{bin,libexec,share/doc/epgstation,share/man/man1}
|
||||
mkdir -p $out/{bin,libexec,share/doc/epgstation}
|
||||
|
||||
pushd $out/lib/node_modules/epgstation
|
||||
|
||||
cp -r ${client}/lib/node_modules/epgstation-client/{package-lock.json,node_modules} client/
|
||||
chmod -R u+w client/{package-lock.json,node_modules}
|
||||
|
||||
npm run build
|
||||
|
||||
npm prune --production
|
||||
pushd client
|
||||
npm prune --production
|
||||
popd
|
||||
pushd $out$npmRootPath
|
||||
|
||||
mv config/enc.js.template $out/libexec/enc.js
|
||||
mv LICENSE Readme.md $out/share/doc/epgstation
|
||||
mv doc/* $out/share/doc/epgstation
|
||||
sed 's/@DESCRIPTION@/${drv.meta.description}/g' ${./epgstation.1} \
|
||||
| ${gzip}/bin/gzip > $out/share/man/man1/epgstation.1.gz
|
||||
sed 's/@DESCRIPTION@/${meta.description}/g' ${./epgstation.1} > doc/epgstation.1
|
||||
installManPage doc/epgstation.1
|
||||
rm -rf doc
|
||||
|
||||
# just log to stdout and let journald do its job
|
||||
|
@ -90,42 +97,27 @@ let
|
|||
# symlinks. Without this, they would all be non-writable because they
|
||||
# reside in the Nix store. Note that the source path won't be accessible
|
||||
# at build time.
|
||||
rm -r config data recorded thumbnail
|
||||
rm -r config data drop recorded thumbnail src/db/subscribers src/db/migrations
|
||||
ln -sfT /etc/epgstation config
|
||||
ln -sfT /var/lib/epgstation data
|
||||
ln -sfT /var/lib/epgstation/drop drop
|
||||
ln -sfT /var/lib/epgstation/recorded recorded
|
||||
ln -sfT /var/lib/epgstation/thumbnail thumbnail
|
||||
ln -sfT /var/lib/epgstation/db/subscribers src/db/subscribers
|
||||
ln -sfT /var/lib/epgstation/db/migrations src/db/migrations
|
||||
|
||||
makeWrapper ${nodejs}/bin/npm $out/bin/epgstation \
|
||||
--chdir "$out/lib/node_modules/epgstation" \
|
||||
--chdir $out$npmRootPath \
|
||||
--prefix PATH : ${lib.makeBinPath runtimeDeps} \
|
||||
--set APP_ROOT_PATH "$out/lib/node_modules/epgstation"
|
||||
--set APP_ROOT_PATH $out$npmRootPath
|
||||
|
||||
popd
|
||||
'';
|
||||
|
||||
# NOTE: this may take a while since it has to update all packages in
|
||||
# nixpkgs.nodePackages
|
||||
passthru.updateScript = callPackage ./update.nix { };
|
||||
|
||||
# nodePackages.epgstation is a stub package to fetch npm dependencies and
|
||||
# its meta.platforms is made empty to prevent users from installing it
|
||||
# directly. This technique ensures epgstation can share npm packages with
|
||||
# the rest of nixpkgs while still allowing us to heavily customize the
|
||||
# build. It also allows us to provide devDependencies for the epgstation
|
||||
# build process without doing the same for all the other node packages.
|
||||
meta = drv.meta // {
|
||||
inherit (nodejs.meta) platforms;
|
||||
};
|
||||
});
|
||||
in
|
||||
server // {
|
||||
name = "${pname}-${version}";
|
||||
|
||||
meta = with lib; server.meta // {
|
||||
meta = with lib; {
|
||||
description = "DVR software compatible with Mirakurun.";
|
||||
homepage = "https://github.com/l3tnun/EPGStation";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ midchildan ];
|
||||
|
||||
# NOTE: updateScript relies on this being correct
|
||||
position = toString ./default.nix + ":1";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
{
|
||||
"name": "epgstation",
|
||||
"version": "2.6.20",
|
||||
"description": "DTV Software in Japan.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/l3tnun/EPGStation-V2.git"
|
||||
},
|
||||
"author": "l3tnun",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/l3tnun/EPGStation-V2/issues"
|
||||
},
|
||||
"homepage": "https://github.com/l3tnun/EPGStation-V2#readme",
|
||||
"dependencies": {
|
||||
"arib-subtitle-timedmetadater": "4.0.9",
|
||||
"aribts": "2.1.12",
|
||||
"axios": "0.24.0",
|
||||
"body-parser": "1.19.0",
|
||||
"cors": "2.8.5",
|
||||
"diskusage-ng": "1.0.2",
|
||||
"express": "4.17.1",
|
||||
"express-openapi": "9.3.0",
|
||||
"file-type": "16.5.3",
|
||||
"inversify": "5.1.1",
|
||||
"js-yaml": "4.1.0",
|
||||
"lodash": "4.17.21",
|
||||
"log4js": "6.3.0",
|
||||
"minimist": "1.2.5",
|
||||
"mirakurun": "3.9.0-beta.26",
|
||||
"mkdirp": "1.0.4",
|
||||
"multer": "1.4.3",
|
||||
"mysql": "2.18.1",
|
||||
"openapi-types": "9.3.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"socket.io": "4.3.1",
|
||||
"source-map-support": "0.5.20",
|
||||
"sqlite3": "5.0.11",
|
||||
"swagger-ui-dist": "3.52.5",
|
||||
"typeorm": "0.2.38",
|
||||
"url-join": "4.0.1",
|
||||
"@types/body-parser": "1.19.1",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/file-type": "10.9.1",
|
||||
"@types/js-yaml": "4.0.4",
|
||||
"@types/lodash": "4.14.176",
|
||||
"@types/minimist": "1.2.2",
|
||||
"@types/mkdirp": "1.0.2",
|
||||
"@types/mongodb": "4.0.6",
|
||||
"@types/multer": "1.4.7",
|
||||
"@types/node": "16.11.6",
|
||||
"@types/socket.io": "3.0.1",
|
||||
"@types/source-map-support": "0.5.4",
|
||||
"@types/sqlite3": "3.1.7",
|
||||
"@types/url-join": "4.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "4.33.0",
|
||||
"@typescript-eslint/parser": "4.33.0",
|
||||
"del": "6.0.0",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-plugin-prettier": "3.4.1",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-eslint": "6.0.0",
|
||||
"gulp-plumber": "1.2.1",
|
||||
"gulp-sourcemaps": "3.0.0",
|
||||
"gulp-typescript": "5.0.1",
|
||||
"prettier": "2.4.1",
|
||||
"ts-loader": "9.2.6",
|
||||
"ts-node": "10.4.0",
|
||||
"typescript": "4.4.4"
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
{ gitUpdater
|
||||
, writers
|
||||
, jq
|
||||
, yq
|
||||
, gnused
|
||||
, _experimental-update-script-combinators
|
||||
}:
|
||||
|
||||
let
|
||||
updateSource = gitUpdater {
|
||||
rev-prefix = "v";
|
||||
};
|
||||
updateLocks = writers.writeBash "update-epgstation" ''
|
||||
set -euxo pipefail
|
||||
|
||||
cd "$1"
|
||||
|
||||
# Get the path to the latest source. Note that we can't just pass the value
|
||||
# of epgstation.src directly because it'd be evaluated before we can run
|
||||
# updateScript.
|
||||
SRC="$(nix-build ../../../.. --no-out-link -A epgstation.src)"
|
||||
if [[ "$UPDATE_NIX_OLD_VERSION" == "$(${jq}/bin/jq -r .version "$SRC/package.json")" ]]; then
|
||||
echo "[INFO] Already using the latest version of $UPDATE_NIX_PNAME" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
# Regenerate package.json from the latest source.
|
||||
${jq}/bin/jq '. + {
|
||||
dependencies: (.dependencies + .devDependencies),
|
||||
} | del(.devDependencies, .main, .scripts)' \
|
||||
"$SRC/package.json" \
|
||||
> package.json
|
||||
${jq}/bin/jq '. + {
|
||||
dependencies: (.dependencies + .devDependencies),
|
||||
} | del(.devDependencies, .main, .scripts)' \
|
||||
"$SRC/client/package.json" \
|
||||
> client/package.json
|
||||
|
||||
# Fix issue with old sqlite3 version pinned that depends on very old node-gyp 3.x
|
||||
${gnused}/bin/sed -i -e 's/"sqlite3":\s*"5.0.[0-9]\+"/"sqlite3": "5.0.11"/' package.json
|
||||
|
||||
# Regenerate node packages to update the pre-overridden epgstation derivation.
|
||||
# This must come *after* package.json has been regenerated.
|
||||
pushd ../../../development/node-packages
|
||||
./generate.sh
|
||||
popd
|
||||
|
||||
# Generate default streaming settings for the nixos module.
|
||||
pushd ../../../../nixos/modules/services/video/epgstation
|
||||
${yq}/bin/yq -j '{ urlscheme , stream }' \
|
||||
"$SRC/config/config.yml.template" \
|
||||
> streaming.json
|
||||
|
||||
# Fix generated output for EditorConfig compliance
|
||||
printf '\n' >> streaming.json # rule: insert_final_newline
|
||||
popd
|
||||
'';
|
||||
in
|
||||
_experimental-update-script-combinators.sequence [
|
||||
updateSource
|
||||
[updateLocks ./.]
|
||||
]
|
|
@ -16,7 +16,7 @@ index 5591853b..838c06cb 100644
|
|||
ormConfig.charset = config.mysql.charset;
|
||||
}
|
||||
+ if (config.mysql.socketPath) {
|
||||
+ ormConfig.socketPath = config.mysql.socketPath;
|
||||
+ ormConfig.extra = { socketPath: config.mysql.socketPath };
|
||||
+ } else {
|
||||
+ ormConfig.host = config.mysql.host;
|
||||
+ ormConfig.port = config.mysql.port;
|
||||
|
|
|
@ -128,8 +128,6 @@
|
|||
, "elm-test"
|
||||
, "emoj"
|
||||
, "emojione"
|
||||
, {"epgstation": "../../applications/video/epgstation"}
|
||||
, {"epgstation-client": "../../applications/video/epgstation/client"}
|
||||
, "escape-string-regexp"
|
||||
, "eslint"
|
||||
, "eslint_d"
|
||||
|
|
4346
pkgs/development/node-packages/node-packages.nix
generated
4346
pkgs/development/node-packages/node-packages.nix
generated
File diff suppressed because it is too large
Load diff
|
@ -139,20 +139,6 @@ final: prev: {
|
|||
name = "eask";
|
||||
};
|
||||
|
||||
# NOTE: this is a stub package to fetch npm dependencies for
|
||||
# ../../applications/video/epgstation
|
||||
epgstation = prev."epgstation-../../applications/video/epgstation".override (oldAttrs: {
|
||||
buildInputs = [ pkgs.postgresql ];
|
||||
nativeBuildInputs = [ final.node-pre-gyp final.node-gyp-build pkgs.which ];
|
||||
meta = oldAttrs.meta // { platforms = lib.platforms.none; };
|
||||
});
|
||||
|
||||
# NOTE: this is a stub package to fetch npm dependencies for
|
||||
# ../../applications/video/epgstation/client
|
||||
epgstation-client = prev."epgstation-client-../../applications/video/epgstation/client".override (oldAttrs: {
|
||||
meta = oldAttrs.meta // { platforms = lib.platforms.none; };
|
||||
});
|
||||
|
||||
expo-cli = prev."expo-cli".override (oldAttrs: {
|
||||
# The traveling-fastlane-darwin optional dependency aborts build on Linux.
|
||||
dependencies = builtins.filter (d: d.packageName != "@expo/traveling-fastlane-${if stdenv.isLinux then "darwin" else "linux"}") oldAttrs.dependencies;
|
||||
|
|
|
@ -30186,9 +30186,7 @@ with pkgs;
|
|||
|
||||
epeg = callPackage ../applications/graphics/epeg { };
|
||||
|
||||
epgstation = callPackage ../applications/video/epgstation {
|
||||
nodejs = nodejs_16;
|
||||
};
|
||||
epgstation = callPackage ../applications/video/epgstation { };
|
||||
|
||||
inherit (gnome) epiphany;
|
||||
|
||||
|
|
Loading…
Reference in a new issue