summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/yn/ynetd/package.nix
blob: 5a20bea987a14b484641a42adebdf9960b34eba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
  lib,
  stdenv,
  fetchurl,
  callPackage,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "ynetd";
  version = "2024.02.17";

  src = fetchurl {
    url = "https://yx7.cc/code/ynetd/ynetd-2024.02.17.tar.xz";
    hash = "sha256-7gioQ0r0LlUftIWKRwTqeZQl0GtskcRKaEE5z6A0S24=";
  };

  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace Makefile --replace-fail "-Wl,-z,relro,-z,now" ""
  '';

  installPhase = ''
    runHook preInstall
    install -Dm755 ynetd $out/bin/ynetd
    runHook postInstall
  '';

  # ctf-ynetd releases are based on the last stable ynetd version
  # these should be kept in sync when possible
  passthru.hardened = callPackage ./hardened.nix { };

  meta = {
    description = "Small server for binding programs to TCP ports";
    homepage = "https://yx7.cc/code/";
    license = lib.licenses.mit;
    platforms = lib.platforms.unix;
    maintainers = [ lib.maintainers.haylin ];
    mainProgram = "ynetd";
  };
})