~aasg/nixexprs

ref: ef110d1cd4cb6308092c7ebb332d2793fd026c5b nixexprs/pkgs/servers/monitoring/bird-lg/default.nix -rw-r--r-- 1.7 KiB
ef110d1c — Aluísio Augusto Silva Gonçalves bird-lg: Move local patches to patches/, per policy 5 months ago
                                                                                
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
65
{ stdenv, fetchFromGitHub, fetchpatch, graphviz, python3, traceroute, whois }:
let
  runtimeDeps = [
    (python3.withPackages (ps: with ps; [
      flask
      dnspython
      gunicorn
      pydot
      memcached
    ]))
    graphviz
    whois
    traceroute
  ];
in
stdenv.mkDerivation rec {
  pname = "bird-lg-burble";
  version = "2020-05-20-unstable";

  src = fetchFromGitHub {
    owner = "sesa-me";
    repo = "bird-lg";
    rev = "f3699a3b61f2d9f77cb17fb163bcf3c3ad722835"; # refs/head/burble-clean
    sha256 = "0gisi6mbfclw36kms3qy3b0wzcwdkd50p2a6xdwggln4fi5y6bh1";
  };

  patches = [
    (fetchpatch {
      name = "fix-bgpmap-generation.patch";
      url = "https://github.com/sesa-me/bird-lg/commit/db8fb829d51889fab61bfb5ffac89199442d3117.patch";
      sha256 = "1vwr7ck5v7w4fr78kbc4wxyj3licsw7h0772xkmmxsb8vp9vcihg";
    })
  ];

  WRAPPER_PATH = stdenv.lib.makeBinPath runtimeDeps;
  WRAPPER_PYTHONPATH = placeholder "out";

  installPhase = ''
    function wrapWSGI {
      set -e
      substitute ${./run-wsgi.sh} "$2" \
        --subst-var shell \
        --subst-var WRAPPER_PATH \
        --subst-var WRAPPER_PYTHONPATH \
        --subst-var-by SCRIPT "$1"
      chmod +x "$2"
    }

    runHook preInstall
    mkdir -p $out $out/bin
    cp -r * $out
    touch $out/__init__.py
    wrapWSGI lg:app $out/bin/bird-lg-webservice
    wrapWSGI lgproxy:app $out/bin/bird-lg-proxy
    runHook postInstall
  '';

  meta = with stdenv.lib; {
    description = "Looking glass for the BIRD Internet Routing Daemon";
    homepage = "https://github.com/sesa-me/bird-lg";
    license = licenses.gpl3Only;
    platforms = platforms.unix;
    maintainers = with maintainers; [ AluisioASG ];
  };
}