diff options
author | Morgan Helton <mhelton@gmail.com> | 2023-04-02 19:01:56 -0500 |
---|---|---|
committer | Morgan Helton <mhelton@gmail.com> | 2023-04-02 19:01:56 -0500 |
commit | 42ca62eb014f3f55a5d3d23c73bacb1e79bad64e (patch) | |
tree | 081f7eca82e6105313b3187fdc5941ba4f2b604d /pkgs/servers/sunshine | |
parent | 8c57d13c13ac38814ed99afe87d5c9984fdaa3c7 (diff) |
sunshine: add updater script
Diffstat (limited to 'pkgs/servers/sunshine')
-rw-r--r-- | pkgs/servers/sunshine/default.nix | 2 | ||||
-rwxr-xr-x | pkgs/servers/sunshine/updater.sh | 23 |
2 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/servers/sunshine/default.nix b/pkgs/servers/sunshine/default.nix index 21ffb28a25cab..417cac9510f59 100644 --- a/pkgs/servers/sunshine/default.nix +++ b/pkgs/servers/sunshine/default.nix @@ -153,6 +153,8 @@ stdenv.mkDerivation rec { --set LD_LIBRARY_PATH ${lib.makeLibraryPath [ vulkan-loader ]} ''; + passthru.updateScript = ./updater.sh; + meta = with lib; { description = "Sunshine is a Game stream host for Moonlight."; homepage = "https://github.com/LizardByte/Sunshine"; diff --git a/pkgs/servers/sunshine/updater.sh b/pkgs/servers/sunshine/updater.sh new file mode 100755 index 0000000000000..43ae46ab6f2f9 --- /dev/null +++ b/pkgs/servers/sunshine/updater.sh @@ -0,0 +1,23 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p gnugrep gnused coreutils curl wget jq nix-update prefetch-npm-deps nodejs + +set -euo pipefail +pushd "$(dirname "${BASH_SOURCE[0]}")" + +version=$(curl -s "https://api.github.com/repos/LizardByte/sunshine/tags" | jq -r .[0].name | grep -oP "^v\K.*") +url="https://raw.githubusercontent.com/LizardByte/sunshine/v$version/" + +if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then + echo "Already up to date!" + exit 0 +fi + +rm -f package-lock.json package.json +wget "$url/package.json" +npm i --package-lock-only +npm_hash=$(prefetch-npm-deps package-lock.json) +sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' default.nix +rm -f package.json + +popd +nix-update sunshine --version $version |