From 1d8fbd2cdde91150541bf50a2d9d95f6b6ff923d Mon Sep 17 00:00:00 2001 From: guochao Date: Fri, 15 Jul 2022 12:59:49 +0800 Subject: [PATCH] add clash-updater --- pkgs/network/proxy/clash-premium/default.nix | 17 ++++++++++++++++- pkgs/network/proxy/clash-premium/updater.sh | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 pkgs/network/proxy/clash-premium/updater.sh diff --git a/pkgs/network/proxy/clash-premium/default.nix b/pkgs/network/proxy/clash-premium/default.nix index e6daa0d..0c45724 100644 --- a/pkgs/network/proxy/clash-premium/default.nix +++ b/pkgs/network/proxy/clash-premium/default.nix @@ -49,6 +49,20 @@ stdenv.mkDerivation { fi ''; + makeUpdater = { subscription, name }: stdenv.mkDerivation { + name = "clash-updater-${name}"; + src = ./updater.sh; + + dontConfigure = true; + dontBuild = true; + dontPatchELF = true; + dontUnpack = true; + + installPhase = '' + makeWrapper $src $out/bin/clash-updater-${name} --set SUBSCRIPTION_URL "${subscription}" + ''; + }; + meta = { description = "close-sourced pre-built Clash binary with TUN support and more"; homepage = "https://github.com/Dreamacro/clash/releases/premium"; @@ -59,4 +73,5 @@ stdenv.mkDerivation { "aarch64-linux" ]; }; -} \ No newline at end of file +} + diff --git a/pkgs/network/proxy/clash-premium/updater.sh b/pkgs/network/proxy/clash-premium/updater.sh new file mode 100644 index 0000000..bb26473 --- /dev/null +++ b/pkgs/network/proxy/clash-premium/updater.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euo pipefail +IFS=$'\n\t' + +env + +sleep 10000