fluffychat: 1.22.1 -> 1.23.0 (#364091)
[NixPkgs.git] / pkgs / by-name / ud / udp2raw / package.nix
blob28f7b6bc10c611c6dedfcb435f92564198b782ff
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   fetchpatch,
6   cmake,
7   makeWrapper,
8   iptables,
9 }:
11 stdenv.mkDerivation rec {
12   pname = "udp2raw";
13   version = "20230206.0";
15   src = fetchFromGitHub {
16     owner = "wangyu-";
17     repo = "udp2raw";
18     rev = version;
19     hash = "sha256-mchSaqw6sOJ7+dydCM8juP7QMOVUrPL4MFA79Rvyjdo=";
20   };
22   patches = [
23     # Add install target to CMakeLists.txt
24     # https://github.com/wangyu-/udp2raw/pull/469
25     (fetchpatch {
26       url = "https://github.com/wangyu-/udp2raw/commit/4559e6d47bb69fda0fbd3fb4b7d04ddb1cf5e2ae.patch";
27       hash = "sha256-2csZdXmMW89tjXhN5QIK0rnMSXlFjLvwGnmieeKRX90=";
28     })
29   ];
31   postPatch = ''
32     echo 'const char *gitversion = "${version}";' > git_version.h
33     # Adress sanitization crashes the application, reported upstream at https://github.com/wangyu-/udp2raw/issues/474
34     substituteInPlace CMakeLists.txt --replace "sanitize=address," "sanitize="
35   '';
37   nativeBuildInputs = [
38     cmake
39     makeWrapper
40   ];
42   postInstall = ''
43     wrapProgram "$out/bin/udp2raw" --prefix PATH : "${lib.makeBinPath [ iptables ]}"
44   '';
46   meta = with lib; {
47     homepage = "https://github.com/wangyu-/udp2raw";
48     description = "Tunnel which turns UDP traffic into encrypted UDP/FakeTCP/ICMP traffic by using a raw socket";
49     mainProgram = "udp2raw";
50     license = licenses.mit;
51     changelog = "https://github.com/wangyu-/udp2raw/releases/tag/${version}";
52     maintainers = with maintainers; [ chvp ];
53     platforms = platforms.linux;
54   };