67 lines
2.2 KiB
Nix
67 lines
2.2 KiB
Nix
{
|
|
clash-premium = { pkgs, stdenv, fetchurl, version, ... }: with pkgs;let
|
|
systemTriple = {
|
|
"x86_64-darwin" = {
|
|
system = "darwin-amd64";
|
|
sha256 = "ccdb2760be48c2f51106fcc16c995cbd7d1a64cd5f742f44c9cba8ddc9bcba9c";
|
|
};
|
|
"aarch64-darwin" = {
|
|
system = "darwin-arm64";
|
|
sha256 = "9c3dbbb237e45c23f166911ad728d7b88e513ffdb9ac7ba8c7c77b41591945a6";
|
|
};
|
|
"x86_64-linux" = {
|
|
system = "linux-amd64";
|
|
sha256 = "26618ff738a8bb3490148d64be933e7a399089b28ff1434f0d78663640425a2f";
|
|
};
|
|
"aarch64-linux" = {
|
|
system = "linux-armv7";
|
|
sha256 = "f6086b37866b4ea2b9e4204d171d18fdcd44c7d81d2c1a0b22a305f369d204a3";
|
|
};
|
|
};
|
|
currentTriple = systemTriple."${stdenv.targetPlatform.system}";
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
name = "clash-premium";
|
|
src = fetchurl {
|
|
url = "https://github.com/Dreamacro/clash/releases/download/premium/clash-${currentTriple.system}-${version}.gz";
|
|
sha256 = currentTriple.sha256;
|
|
};
|
|
dontConfigure = true;
|
|
dontBuild = true;
|
|
dontPatchELF = true;
|
|
doInstallCheck = true;
|
|
|
|
unpackPhase = ''
|
|
FILENAME=$(${coreutils}/bin/basename $src)
|
|
${coreutils}/bin/cp $src clash.gz
|
|
${gzip}/bin/gzip -k -d clash.gz
|
|
'';
|
|
installPhase = ''
|
|
runHook preInstall
|
|
${coreutils}/bin/mkdir -p $out/bin
|
|
${coreutils}/bin/install -m 0755 clash $out/bin/clash
|
|
|
|
if [ "${system}" == "linux" ]; then
|
|
patchelf \
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
$out/bin/clash
|
|
fi
|
|
'';
|
|
|
|
|
|
meta = {
|
|
description = "close-sourced pre-built Clash binary with TUN support and more";
|
|
homepage = "https://github.com/Dreamacro/clash/releases/premium";
|
|
platforms = [
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
};
|
|
};
|
|
|
|
clash-updater = import ./updater.nix;
|
|
}
|