commit 137633587bc534a4dfa9ddd9d32b0243ebfbf404 Author: guochao Date: Sun Jul 10 18:08:42 2022 +0800 initial commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..65326bb --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..1cb3483 --- /dev/null +++ b/default.nix @@ -0,0 +1 @@ +import ./pkgs/top-level/all-packages.nix \ No newline at end of file diff --git a/pkgs/network/proxy/clash-premium/default.nix b/pkgs/network/proxy/clash-premium/default.nix new file mode 100644 index 0000000..e6daa0d --- /dev/null +++ b/pkgs/network/proxy/clash-premium/default.nix @@ -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" + ]; + }; +} \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix new file mode 100644 index 0000000..d4fc857 --- /dev/null +++ b/pkgs/top-level/all-packages.nix @@ -0,0 +1,5 @@ +with import {}; +with pkgs; +{ + clash-premium = callPackage ../network/proxy/clash-premium { version = "2022.07.07"; }; +} \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..033b343 --- /dev/null +++ b/shell.nix @@ -0,0 +1,7 @@ +{ pkgs? (import {}).pkgs, thispkgs? (import ./.)}: + +pkgs.mkShell { + buildInputs = [ + + ]; +} \ No newline at end of file