about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/clash-meta/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/networking/clash-meta/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/networking/clash-meta/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/networking/clash-meta/default.nix b/nixpkgs/pkgs/tools/networking/clash-meta/default.nix
new file mode 100644
index 000000000000..804e2f44b442
--- /dev/null
+++ b/nixpkgs/pkgs/tools/networking/clash-meta/default.nix
@@ -0,0 +1,48 @@
+{ lib
+, fetchFromGitHub
+, buildGoModule
+}:
+buildGoModule rec {
+  pname = "clash-meta";
+  version = "1.14.5";
+
+  src = fetchFromGitHub {
+    owner = "MetaCubeX";
+    repo = "Clash.Meta";
+    rev = "v${version}";
+    # macOS has a case-insensitive filesystem, so these two can be the same file
+    postFetch = ''
+      rm -f $out/.github/workflows/{Delete,delete}.yml
+    '';
+    hash = "sha256-4jhe+zhcRACcwwPWFd5oW8eIKTpPWfz0z5cnA9E8Wkc=";
+  };
+
+  vendorHash = "sha256-VcT9dda5E9IMrDB/3QWBGWiNxGAEM2yKDbJwhGpN8og=";
+
+  # Do not build testing suit
+  excludedPackages = [ "./test" ];
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X github.com/Dreamacro/clash/constant.Version=${version}"
+  ];
+
+  tags = [
+    "with_gvisor"
+  ];
+
+  # network required
+  doCheck = false;
+
+  postInstall = ''
+    mv $out/bin/clash $out/bin/clash-meta
+  '';
+
+  meta = with lib; {
+    description = "Another Clash Kernel";
+    homepage = "https://github.com/MetaCubeX/Clash.Meta";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ oluceps ];
+  };
+}