aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/applications/video/epgstation')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/default.nix163
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/applications/video/epgstation/generate.sh34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/package.json102
-rw-r--r--infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/update.nix66
4 files changed, 209 insertions, 156 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/default.nix
index e57f46c8c6ad..62aa54ca7844 100644
--- a/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/default.nix
+++ b/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/default.nix
@@ -1,6 +1,27 @@
-{ stdenv, fetchFromGitHub, makeWrapper, bash, nodejs, nodePackages, gzip }:
+{ stdenv
+, fetchFromGitHub
+, common-updater-scripts
+, genericUpdater
+, writers
+, makeWrapper
+, bash
+, nodejs
+, nodePackages
+, gzip
+, jq
+}:
let
+ # NOTE: use updateScript to bump the package version
+ pname = "EPGStation";
+ version = "1.7.5";
+ src = fetchFromGitHub {
+ owner = "l3tnun";
+ repo = "EPGStation";
+ rev = "v${version}";
+ sha256 = "06yaf5yb5rp3q0kdhw33df7px7vyfby885ckb6bdzw3wnams5d8m";
+ };
+
workaround-opencollective-buildfailures = stdenv.mkDerivation {
# FIXME: This should be removed when a complete fix is available
# https://github.com/svanderburg/node2nix/issues/145
@@ -12,67 +33,73 @@ let
chmod +x $out/bin/opencollective-postinstall
'';
};
-in
-nodePackages.epgstation.override (drv: {
- src = fetchFromGitHub {
- owner = "l3tnun";
- repo = "EPGStation";
- rev = "v${drv.version}"; # version specified in ./generate.sh
- sha256 = "15z1kdbamj97frp3dfnbm0h8krihmv2xdab4id0rxin29ibrw1k2";
- };
- buildInputs = [ bash ];
- nativeBuildInputs = [
- workaround-opencollective-buildfailures
- makeWrapper
- nodePackages.node-pre-gyp
- ];
-
- preRebuild = ''
- # Fix for not being able to connect to mysql using domain sockets.
- patch -p1 ${./use-mysql-over-domain-socket.patch}
- '';
-
- postInstall = let
- runtimeDeps = [ nodejs bash ];
- in
- ''
- mkdir -p $out/{bin,libexec,share/doc/epgstation,share/man/man1}
-
- pushd $out/lib/node_modules/EPGStation
-
- npm run build
- npm prune --production
-
- mv config/{enc.sh,enc.js} $out/libexec
- 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
- rm -rf doc
-
- # just log to stdout and let journald do its job
- rm -rf logs
-
- # Replace the existing configuration and runtime state directories with
- # 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
- ln -sfT /etc/epgstation config
- ln -sfT /var/lib/epgstation data
- ln -sfT /var/lib/epgstation/recorded recorded
- ln -sfT /var/lib/epgstation/thumbnail thumbnail
-
- makeWrapper ${nodejs}/bin/npm $out/bin/epgstation \
- --run "cd $out/lib/node_modules/EPGStation" \
- --prefix PATH : ${stdenv.lib.makeBinPath runtimeDeps}
-
- popd
- '';
-
- meta = with stdenv.lib; drv.meta // {
- maintainers = with maintainers; [ midchildan ];
+ pkg = nodePackages.epgstation.override (drv: {
+ inherit src;
+
+ buildInputs = [ bash ];
+ nativeBuildInputs = [
+ workaround-opencollective-buildfailures
+ makeWrapper
+ nodePackages.node-pre-gyp
+ ];
+
+ preRebuild = ''
+ # Fix for not being able to connect to mysql using domain sockets.
+ patch -p1 ${./use-mysql-over-domain-socket.patch}
+ '';
+
+ postInstall = let
+ runtimeDeps = [ nodejs bash ];
+ in
+ ''
+ mkdir -p $out/{bin,libexec,share/doc/epgstation,share/man/man1}
+
+ pushd $out/lib/node_modules/EPGStation
+
+ npm run build
+ npm prune --production
+
+ mv config/{enc.sh,enc.js} $out/libexec
+ 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
+ rm -rf doc
+
+ # just log to stdout and let journald do its job
+ rm -rf logs
+
+ # Replace the existing configuration and runtime state directories with
+ # 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
+ ln -sfT /etc/epgstation config
+ ln -sfT /var/lib/epgstation data
+ ln -sfT /var/lib/epgstation/recorded recorded
+ ln -sfT /var/lib/epgstation/thumbnail thumbnail
+
+ makeWrapper ${nodejs}/bin/npm $out/bin/epgstation \
+ --run "cd $out/lib/node_modules/EPGStation" \
+ --prefix PATH : ${stdenv.lib.makeBinPath runtimeDeps}
+
+ popd
+ '';
+
+ # NOTE: this may take a while since it has to update all packages in
+ # nixpkgs.nodePackages
+ passthru.updateScript = import ./update.nix {
+ inherit (stdenv) lib;
+ inherit (src.meta) homepage;
+ inherit
+ pname
+ version
+ common-updater-scripts
+ genericUpdater
+ writers
+ jq;
+ };
# nodePackages.epgstation is a stub package to fetch npm dependencies and
# is marked as broken to prevent users from installing it directly. This
@@ -80,6 +107,16 @@ nodePackages.epgstation.override (drv: {
# 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.
- broken = false;
+ meta = drv.meta // { broken = false; };
+ });
+in
+pkg // {
+ name = "${pname}-${version}";
+
+ meta = with stdenv.lib; pkg.meta // {
+ maintainers = with maintainers; [ midchildan ];
+
+ # NOTE: updateScript relies on this being correct
+ position = toString ./default.nix + ":1";
};
-})
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/generate.sh b/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/generate.sh
deleted file mode 100755
index d193a015064c..000000000000
--- a/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/generate.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-
-# Script to generate the Nix package definition for EPGStation. Run this script
-# when bumping the package version.
-
-VERSION="1.7.4"
-URL="https://raw.githubusercontent.com/l3tnun/EPGStation/v$VERSION/package.json"
-JQ_BIN="$(nix-build ../../../.. --no-out-link -A jq)/bin/jq"
-
-set -eu -o pipefail
-cd "$(dirname "${BASH_SOURCE[0]}")"
-
-main() {
- # update package.json
- curl -sSfL "$URL" \
- | jq '. + {"dependencies": (.devDependencies + .dependencies)} | del(.devDependencies)' \
- > package.json
-
- # regenerate node packages to update the actual Nix package
- pushd ../../../development/node-packages \
- && ./generate.sh
- popd
-
- # generate default streaming settings for EPGStation
- pushd ../../../../nixos/modules/services/video/epgstation \
- && cat "$(./generate)" > streaming.json
- popd
-}
-
-jq() {
- "$JQ_BIN" "$@"
-}
-
-main "@"
diff --git a/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/package.json b/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/package.json
index 96525ec809ec..53b1ebca2da7 100644
--- a/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/package.json
+++ b/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/package.json
@@ -1,23 +1,7 @@
{
"name": "EPGStation",
- "version": "1.7.4",
+ "version": "1.7.5",
"description": "DTV Software in Japan.",
- "main": "dist/server/index.js",
- "scripts": {
- "start": "node dist/server/index.js",
- "dev-start": "node dist/server/index.js --env development",
- "clean": "gulp clean",
- "build": "gulp build --max_old_space_size=768 --env production",
- "dev-build": "gulp build --max_old_space_size=512 --env development",
- "test": "echo \"Error: no test specified\" && exit 1",
- "task": "gulp --max_old_space_size=512",
- "install-win-service": "winser -i -a",
- "uninstall-win-service": "winser -r -x",
- "backup": "node dist/server/DBTools.js -m backup -o",
- "restore": "node dist/server/DBTools.js -m restore -o",
- "move-log": "node dist/server/LogFileMoveTools.js",
- "convert-str": "node dist/server/ConvertDBStrTools.js"
- },
"repository": {
"type": "git",
"url": "https://github.com/l3tnun/EPGStation.git"
@@ -32,41 +16,6 @@
"node": "^10.x.x < 11 || ^12.14.0 < 13 || ^14.5.0 < 15"
},
"dependencies": {
- "@types/basic-auth": "1.1.3",
- "@types/body-parser": "1.19.0",
- "@types/chart.js": "2.9.23",
- "@types/express": "4.17.7",
- "@types/hls.js": "0.13.0",
- "@types/js-yaml": "3.12.5",
- "@types/lodash": "4.14.158",
- "@types/material-design-lite": "1.1.16",
- "@types/minimist": "1.2.0",
- "@types/mithril": "2.0.3",
- "@types/mkdirp": "1.0.1",
- "@types/multer": "1.4.3",
- "@types/mysql": "2.15.15",
- "@types/node": "14.0.26",
- "@types/pg": "7.14.4",
- "@types/request": "2.48.5",
- "@types/socket.io": "2.1.10",
- "@types/socket.io-client": "1.4.33",
- "@types/sqlite3": "3.1.6",
- "@types/url-join": "4.0.0",
- "del": "5.1.0",
- "gulp": "4.0.2",
- "gulp-clean-css": "4.3.0",
- "gulp-concat": "2.6.1",
- "gulp-dart-sass": "1.0.2",
- "gulp-plumber": "1.2.1",
- "gulp-sourcemaps": "2.6.5",
- "gulp-tslint": "8.1.4",
- "gulp-typescript": "5.0.1",
- "terser-webpack-plugin": "3.0.7",
- "ts-loader": "8.0.1",
- "tslint": "6.1.2",
- "typescript": "3.9.7",
- "webpack": "4.44.0",
- "webpack-stream": "5.2.1",
"aribts": "^2.1.12",
"b24.js": "1.0.3",
"basic-auth": "2.0.1",
@@ -75,27 +24,62 @@
"css-ripple-effect": "1.0.5",
"diskusage": "1.1.3",
"express": "4.17.1",
- "express-openapi": "7.0.0",
+ "express-openapi": "7.0.1",
"fs-extra": "9.0.1",
"hls-b24.js": "0.12.3",
"js-yaml": "3.14.0",
- "lodash": "4.17.19",
+ "lodash": "4.17.20",
"log4js": "6.3.0",
"material-design-icons": "3.0.1",
"material-design-lite": "1.3.0",
"minimist": "1.2.5",
- "mirakurun": "3.2.0",
+ "mirakurun": "3.3.1",
"mithril": "2.0.4",
"mkdirp": "1.0.4",
"multer": "1.4.2",
"mysql": "2.18.1",
- "openapi-types": "7.0.0",
- "pg": "8.3.0",
+ "openapi-types": "7.0.1",
+ "pg": "8.3.3",
"request": "2.88.2",
"socket.io": "2.3.0",
"socket.io-client": "2.3.0",
"sqlite3": "5.0.0",
- "swagger-ui-dist": "3.30.2",
- "url-join": "4.0.1"
+ "swagger-ui-dist": "3.34.0",
+ "url-join": "4.0.1",
+ "@types/basic-auth": "1.1.3",
+ "@types/body-parser": "1.19.0",
+ "@types/chart.js": "2.9.24",
+ "@types/express": "4.17.8",
+ "@types/hls.js": "0.13.1",
+ "@types/js-yaml": "3.12.5",
+ "@types/lodash": "4.14.161",
+ "@types/material-design-lite": "1.1.16",
+ "@types/minimist": "1.2.0",
+ "@types/mithril": "2.0.3",
+ "@types/mkdirp": "1.0.1",
+ "@types/multer": "1.4.4",
+ "@types/mysql": "2.15.15",
+ "@types/node": "14.11.1",
+ "@types/pg": "7.14.5",
+ "@types/request": "2.48.5",
+ "@types/socket.io": "2.1.11",
+ "@types/socket.io-client": "1.4.33",
+ "@types/sqlite3": "3.1.6",
+ "@types/url-join": "4.0.0",
+ "del": "5.1.0",
+ "gulp": "4.0.2",
+ "gulp-clean-css": "4.3.0",
+ "gulp-concat": "2.6.1",
+ "gulp-dart-sass": "1.0.2",
+ "gulp-plumber": "1.2.1",
+ "gulp-sourcemaps": "2.6.5",
+ "gulp-tslint": "8.1.4",
+ "gulp-typescript": "5.0.1",
+ "terser-webpack-plugin": "4.2.2",
+ "ts-loader": "8.0.4",
+ "tslint": "6.1.3",
+ "typescript": "4.0.3",
+ "webpack": "4.44.2",
+ "webpack-stream": "6.1.0"
}
}
diff --git a/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/update.nix b/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/update.nix
new file mode 100644
index 000000000000..9faa83c64f9e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/update.nix
@@ -0,0 +1,66 @@
+{ pname
+, version
+, homepage
+, lib
+, common-updater-scripts
+, genericUpdater
+, writers
+, jq
+}:
+
+let
+ updater = genericUpdater {
+ inherit pname version;
+ attrPath = lib.toLower pname;
+ rev-prefix = "v";
+ versionLister = "${common-updater-scripts}/bin/list-git-tags ${homepage}";
+ };
+ updateScript = builtins.elemAt updater 0;
+ updateArgs = map (lib.escapeShellArg) (builtins.tail updater);
+in writers.writeBash "update-epgstation" ''
+ set -euxo pipefail
+
+ # bump the version
+ ${updateScript} ${lib.concatStringsSep " " updateArgs}
+
+ cd "${toString ./.}"
+
+ # 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 [[ "${version}" == "$(${jq}/bin/jq -r .version "$SRC/package.json")" ]]; then
+ echo "[INFO] Already using the latest version of ${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
+
+ # Regenerate node packages to update the pre-overriden 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
+ ${jq}/bin/jq '
+ { liveHLS
+ , liveMP4
+ , liveWebM
+ , mpegTsStreaming
+ , mpegTsViewer
+ , recordedDownloader
+ , recordedStreaming
+ , recordedHLS
+ , recordedViewer
+ }' \
+ "$SRC/config/config.sample.json" \
+ > streaming.json
+ popd
+''