parent
038afc6906
commit
323b47d96e
@ -1,31 +0,0 @@ |
||||
#!/usr/bin/env -S nix-build --no-out-link |
||||
|
||||
# Script to generate default streaming configurations for EPGStation. There's |
||||
# no need to run this script directly since generate.sh in the EPGStation |
||||
# package directory would run this script for you. |
||||
# |
||||
# Usage: ./generate | xargs cat > streaming.json |
||||
|
||||
{ pkgs ? (import ../../../../.. {}) }: |
||||
|
||||
let |
||||
sampleConfigPath = "${pkgs.epgstation.src}/config/config.sample.json"; |
||||
sampleConfig = builtins.fromJSON (builtins.readFile sampleConfigPath); |
||||
streamingConfig = { |
||||
inherit (sampleConfig) |
||||
mpegTsStreaming |
||||
mpegTsViewer |
||||
liveHLS |
||||
liveMP4 |
||||
liveWebM |
||||
recordedDownloader |
||||
recordedStreaming |
||||
recordedViewer |
||||
recordedHLS; |
||||
}; |
||||
in |
||||
pkgs.runCommand "streaming.json" { nativeBuildInputs = [ pkgs.jq ]; } '' |
||||
jq . <<<'${builtins.toJSON streamingConfig}' > $out |
||||
'' |
||||
|
||||
# vim:set ft=nix: |
@ -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 "@" |
@ -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 |
||||
'' |
Loading…
Reference in new issue