diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-12-09 18:55:19 +0000 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-12-09 18:55:19 +0000 |
commit | 80d90d9b204f7c17912740f9f414fe5d59f293ba (patch) | |
tree | 5f2065a06e724270610760d59d01c6888b375a46 /infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/update.nix | |
parent | 3a31a84c7d3e589035ad08499206aac44a81f424 (diff) | |
parent | 83cbad92d73216bb0d9187c56cce0b91f9121d5a (diff) |
Merge commit '83cbad92d73216bb0d9187c56cce0b91f9121d5a' into main
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/update.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/applications/video/epgstation/update.nix | 66 |
1 files changed, 66 insertions, 0 deletions
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 +'' |