mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-28 00:24:18 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
55 lines
1.5 KiB
Nix
55 lines
1.5 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, cmake
|
|
, makeWrapper
|
|
, iptables
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "udp2raw";
|
|
version = "20230206.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "wangyu-";
|
|
repo = "udp2raw";
|
|
rev = version;
|
|
hash = "sha256-mchSaqw6sOJ7+dydCM8juP7QMOVUrPL4MFA79Rvyjdo=";
|
|
};
|
|
|
|
patches = [
|
|
# Add install target to CMakeLists.txt
|
|
# https://github.com/wangyu-/udp2raw/pull/469
|
|
(fetchpatch {
|
|
url = "https://github.com/wangyu-/udp2raw/commit/4559e6d47bb69fda0fbd3fb4b7d04ddb1cf5e2ae.patch";
|
|
hash = "sha256-2csZdXmMW89tjXhN5QIK0rnMSXlFjLvwGnmieeKRX90=";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
echo 'const char *gitversion = "${version}";' > git_version.h
|
|
# Adress sanitization crashes the application, reported upstream at https://github.com/wangyu-/udp2raw/issues/474
|
|
substituteInPlace CMakeLists.txt --replace "sanitize=address," "sanitize="
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
makeWrapper
|
|
];
|
|
|
|
postInstall = ''
|
|
wrapProgram "$out/bin/udp2raw" --prefix PATH : "${lib.makeBinPath [ iptables ]}"
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/wangyu-/udp2raw";
|
|
description = "Tunnel which turns UDP traffic into encrypted UDP/FakeTCP/ICMP traffic by using a raw socket";
|
|
mainProgram = "udp2raw";
|
|
license = licenses.mit;
|
|
changelog = "https://github.com/wangyu-/udp2raw/releases/tag/${version}";
|
|
maintainers = with maintainers; [ chvp ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|