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