seperate clash-updater
This commit is contained in:
parent
7270a94cde
commit
1c484f8caa
@ -1,6 +1,5 @@
|
|||||||
{ pkgs, stdenv, fetchurl, version, ... }: with pkgs;
|
{
|
||||||
|
clash-premium = { pkgs, stdenv, fetchurl, version, ... }: with pkgs;let
|
||||||
let
|
|
||||||
systemTriple = {
|
systemTriple = {
|
||||||
"x86_64-darwin" = {
|
"x86_64-darwin" = {
|
||||||
system = "darwin-amd64";
|
system = "darwin-amd64";
|
||||||
@ -21,6 +20,7 @@ let
|
|||||||
};
|
};
|
||||||
currentTriple = systemTriple."${stdenv.targetPlatform.system}";
|
currentTriple = systemTriple."${stdenv.targetPlatform.system}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "clash-premium";
|
name = "clash-premium";
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
@ -49,26 +49,6 @@ stdenv.mkDerivation {
|
|||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
makeUpdater = { subscription, name }: stdenv.mkDerivation {
|
|
||||||
name = "clash-updater-${name}";
|
|
||||||
src = ./updater.sh;
|
|
||||||
buildInputs = [
|
|
||||||
makeWrapper
|
|
||||||
];
|
|
||||||
|
|
||||||
dontConfigure = true;
|
|
||||||
dontBuild = true;
|
|
||||||
dontPatchELF = true;
|
|
||||||
dontUnpack = true;
|
|
||||||
|
|
||||||
checkPhase = ''
|
|
||||||
patchShebangs bin
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
makeWrapper $src $out/bin/clash-updater-${name} --set SUBSCRIPTION_URL "${subscription}"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "close-sourced pre-built Clash binary with TUN support and more";
|
description = "close-sourced pre-built Clash binary with TUN support and more";
|
||||||
@ -80,5 +60,7 @@ stdenv.mkDerivation {
|
|||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
clash-updater = import ./updater.nix;
|
||||||
|
}
|
||||||
|
20
pkgs/network/proxy/clash-premium/updater.nix
Normal file
20
pkgs/network/proxy/clash-premium/updater.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{ subscription, name }: with import <nixpkgs> {}; stdenv.mkDerivation {
|
||||||
|
name = "clash-updater-${name}";
|
||||||
|
src = ./updater.sh;
|
||||||
|
buildInputs = [
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
dontPatchELF = true;
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
checkPhase = ''
|
||||||
|
patchShebangs bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
makeWrapper $src $out/bin/clash-updater --set SUBSCRIPTION_URL "${subscription}"
|
||||||
|
'';
|
||||||
|
}
|
@ -3,6 +3,24 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
env
|
TEMP=${TEMP:-$(mktemp /tmp/clash-config-XXXXXX)}
|
||||||
|
OUTPUT=${OUTPUT:-$HOME/.config/clash/testoutput.yaml}
|
||||||
|
OUTDIR=$(dirname $OUTPUT)
|
||||||
|
|
||||||
sleep 10000
|
LOG="/tmp/clash-updater.log"
|
||||||
|
|
||||||
|
|
||||||
|
exec > ${LOG}
|
||||||
|
set -x
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
curl -v --continue -o ${TEMP} ${SUBSCRIPTION_URL}
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -eq 0 ]]; then
|
||||||
|
mkdir -pv $OUTDIR
|
||||||
|
cp -v $TEMP $OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep $((3600*24))
|
||||||
|
done
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
with import <nixpkgs> {};
|
with import <nixpkgs> {};
|
||||||
with pkgs;
|
with pkgs;
|
||||||
{
|
{
|
||||||
clash-premium = callPackage ../network/proxy/clash-premium { version = "2022.07.07"; };
|
clash-premium = callPackage (import ../network/proxy/clash-premium).clash-premium { version = "2022.07.07"; };
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user