3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/video/epgstation/update.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.8 KiB
Nix
Raw Normal View History

2020-10-04 12:38:11 +01:00
{ pname
, version
, homepage
, lib
2022-04-23 20:11:35 +01:00
, gitUpdater
2020-10-04 12:38:11 +01:00
, writers
, jq
2022-01-29 12:21:54 +00:00
, yq
2020-10-04 12:38:11 +01:00
}:
let
2022-04-23 20:11:35 +01:00
updater = gitUpdater {
2020-10-04 12:38:11 +01:00
inherit pname version;
attrPath = lib.toLower pname;
rev-prefix = "v";
};
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
2022-01-29 12:21:54 +00:00
${jq}/bin/jq '. + {
dependencies: (.dependencies + .devDependencies),
} | del(.devDependencies, .main, .scripts)' \
"$SRC/client/package.json" \
> client/package.json
2020-10-04 12:38:11 +01:00
# 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
2022-01-29 12:21:54 +00:00
${yq}/bin/yq -j '{ urlscheme , stream }' \
"$SRC/config/config.yml.template" \
2020-10-04 12:38:11 +01:00
> streaming.json
# Fix generated output for EditorConfig compliance
printf '\n' >> streaming.json # rule: insert_final_newline
2020-10-04 12:38:11 +01:00
popd
''