diff --git a/pkgs/by-name/se/servo/package.nix b/pkgs/by-name/se/servo/package.nix index d19cde2a18d4..dfe47663b412 100644 --- a/pkgs/by-name/se/servo/package.nix +++ b/pkgs/by-name/se/servo/package.nix @@ -143,6 +143,8 @@ rustPlatform.buildRustPackage { --prefix LD_LIBRARY_PATH : ${runtimePaths} ''; + passthru.updateScript = ./update.sh; + meta = { description = "The embeddable, independent, memory-safe, modular, parallel web rendering engine"; homepage = "https://servo.org"; diff --git a/pkgs/by-name/se/servo/update.sh b/pkgs/by-name/se/servo/update.sh new file mode 100755 index 000000000000..ffb4265b6c70 --- /dev/null +++ b/pkgs/by-name/se/servo/update.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils common-updater-scripts curl jq nix-update + +# This update script exists, because nix-update is unable to ignore various +# bogus tags that exist on the upstream repo e.g. +# - selectors-v0.18.0/v0.20.0/v0.21.0/v0.22.0 +# - homu-tmp +# +# Once https://github.com/Mic92/nix-update/issues/322 is resolved it can be +# removed. + +set -exuo pipefail + +# Determine latest commit id and date +TMP=$(mktemp) +curl -o "$TMP" https://api.github.com/repos/servo/servo/commits/main +COMMIT_ID=$(jq -r '.sha' "$TMP") +COMMIT_TIMESTAMP=$(jq -r '.commit.author.date' "$TMP") +COMMIT_DATE=$(date -d "$COMMIT_TIMESTAMP" +"%Y-%m-%d") +rm $TMP + +cd "$(git rev-parse --show-toplevel)" + +# Update version, src +update-source-version servo "0-unstable-${COMMIT_DATE}" --file=pkgs/by-name/se/servo/package.nix --rev="$COMMIT_ID" + +# Update cargoHash +nix-update --version=skip servo