initial commit

This commit is contained in:
guochao 2022-07-10 18:08:42 +08:00
commit 137633587b
6 changed files with 77 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use nix

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
result

1
default.nix Normal file
View File

@ -0,0 +1 @@
import ./pkgs/top-level/all-packages.nix

View File

@ -0,0 +1,62 @@
{ 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"
];
};
}

View File

@ -0,0 +1,5 @@
with import <nixpkgs> {};
with pkgs;
{
clash-premium = callPackage ../network/proxy/clash-premium { version = "2022.07.07"; };
}

7
shell.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs? (import <nixpkgs> {}).pkgs, thispkgs? (import ./.)}:
pkgs.mkShell {
buildInputs = [
];
}