about summary refs log tree commit diff
path: root/pkgs/by-name/ub/ubridge/package.nix
blob: c5f467ad6a3b78804b5cbb58e553a972042de985 (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
  lib,
  stdenv,
  fetchFromGitHub,
  libpcap,
  nix-update-script,
  testers,
  ubridge,
}:

stdenv.mkDerivation rec {
  pname = "ubridge";
  version = "0.9.19";

  src = fetchFromGitHub {
    owner = "GNS3";
    repo = "ubridge";
    rev = "refs/tags/v${version}";
    hash = "sha256-utzXLPF0VszMZORoik5/0lKhiyKO9heKuNO4KPsPVsI=";
  };

  postPatch = ''
    substituteInPlace Makefile \
      --replace-fail "/usr/local/bin" "$out/bin" \
      --replace-fail "setcap" "#setcap"
  '';

  buildInputs = [ libpcap ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    install -Dm755 ubridge $out/bin/ubridge

    runHook postInstall
  '';

  passthru = {
    tests.version = testers.testVersion {
      package = ubridge;
      command = "ubridge -v";
    };
    updateScript = nix-update-script { };
  };

  meta = with lib; {
    description = "Bridge for UDP tunnels, Ethernet, TAP, and VMnet interfaces";
    longDescription = ''
      uBridge is a simple application to create user-land bridges between
      various technologies. Currently bridging between UDP tunnels, Ethernet
      and TAP interfaces is supported. Packet capture is also supported.
    '';
    homepage = "https://github.com/GNS3/ubridge";
    changelog = "https://github.com/GNS3/ubridge/releases/tag/v${version}";
    license = licenses.gpl3Plus;
    mainProgram = "ubridge";
    maintainers = with maintainers; [
      primeos
      anthonyroussel
    ];
    platforms = platforms.linux ++ platforms.darwin;
  };
}