From b32d7053fa6155897b4b6aa113c2f96f066114f2 Mon Sep 17 00:00:00 2001 From: Candy Cloud Date: Fri, 9 Dec 2022 10:18:18 +0000 Subject: [PATCH] clash-geoip: add update script --- pkgs/data/misc/clash-geoip/default.nix | 2 ++ pkgs/data/misc/clash-geoip/update.sh | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100755 pkgs/data/misc/clash-geoip/update.sh diff --git a/pkgs/data/misc/clash-geoip/default.nix b/pkgs/data/misc/clash-geoip/default.nix index 6ebded41f09f..3c1fad47b06c 100644 --- a/pkgs/data/misc/clash-geoip/default.nix +++ b/pkgs/data/misc/clash-geoip/default.nix @@ -18,6 +18,8 @@ stdenvNoCC.mkDerivation rec { runHook postInstall ''; + passthru.updateScript = ./update.sh; + meta = with lib; { description = "A GeoLite2 data created by MaxMind"; homepage = "https://github.com/Dreamacro/maxmind-geoip"; diff --git a/pkgs/data/misc/clash-geoip/update.sh b/pkgs/data/misc/clash-geoip/update.sh new file mode 100755 index 000000000000..f4d5edcd5ca8 --- /dev/null +++ b/pkgs/data/misc/clash-geoip/update.sh @@ -0,0 +1,6 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p common-updater-scripts curl jq +set -euo pipefail + +RELEASE=$(curl "https://api.github.com/repos/Dreamacro/maxmind-geoip/releases/latest") +update-source-version clash-geoip "$(echo $RELEASE | jq -r .tag_name)"