summary refs log tree commit diff
path: root/pkgs/servers/bird/default.nix
blob: 2cc27eda1d4d9af32cf4199a061b6ca9c6e3f6d0 (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, fetchurl, fetchpatch, flex, bison, readline, libssh }:

with lib;

let

  generic = { version, sha256, enableIPv6 ? false }:
    stdenv.mkDerivation rec {
      pname = "bird";
      inherit version;

      src = fetchurl {
        inherit sha256;
        url = "ftp://bird.network.cz/pub/bird/${pname}-${version}.tar.gz";
      };

      nativeBuildInputs = [ flex bison ];
      buildInputs = [ readline libssh ];

      patches = [
        (./. + "/dont-create-sysconfdir-${builtins.substring 0 1 version}.patch")
      ]
      ++ optional (lib.versionOlder version "2")
        # https://github.com/BIRD/bird/pull/4
        (fetchpatch {
          url = "https://github.com/BIRD/bird/commit/fca9ab48e3823c734886f47156a92f6b804c16e9.patch";
          sha256 = "1pnndc3n56lqqcy74ln0w5kn3i9rbzsm2dqiyp1qw7j33dpkln1b";
        })
        ;

      CPP="${stdenv.cc.targetPrefix}cpp -E";

      configureFlags = [
        "--localstatedir=/var"
      ] ++ optional enableIPv6 "--enable-ipv6";

      meta = {
        description = "BIRD Internet Routing Daemon";
        homepage = http://bird.network.cz;
        license = licenses.gpl2Plus;
        maintainers = with maintainers; [ fpletz globin ];
        platforms = platforms.linux;
      };
    };

in

{
  bird = generic {
    version = "1.6.8";
    sha256 = "1ch0pkkhd7axdjlvhprynh9q08x0nm984nvkm1cjb7gm5rfsnqbc";
  };

  bird6 = generic {
    version = "1.6.8";
    sha256 = "1ch0pkkhd7axdjlvhprynh9q08x0nm984nvkm1cjb7gm5rfsnqbc";
    enableIPv6 = true;
  };

  bird2 = generic {
    version = "2.0.7";
    sha256 = "0rhhbfmfw2d93rvhglv03rdzxsq2disw6s1wm8d6bgdxmrc2n7b3";
  };
}