summary refs log tree commit diff
path: root/pkgs/servers/monitoring/uchiwa/default.nix
blob: e7cf3e8f70e489b392b892338f3b43c5f1d13b57 (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
{ stdenv, fetchFromGitHub, buildBowerComponents, buildGoPackage, makeWrapper }:

let
  inherit (import ./src.nix) version sha256;
  owner = "sensu";
  repo = "uchiwa";

  src = fetchFromGitHub {
    inherit owner repo sha256;
    rev    = "${version}";
  };

  backend = buildGoPackage {
    name = "uchiwa-backend-${version}";
    goPackagePath = "github.com/${owner}/${repo}";
    inherit src;
    postInstall = ''
      cp go/src/github.com/sensu/uchiwa/public/index.html $out/
    '';
  };

  frontend = buildBowerComponents {
    name = "uchiwa-frontend-${version}";
    generated = ./bower-packages.nix;
    inherit src;
  };

in stdenv.mkDerivation rec {
  name = "uchiwa-${version}";

  inherit src;

  buildInputs = [ makeWrapper ];

  buildCommand = ''
    mkdir -p $out/bin $out/public
    makeWrapper ${backend.bin}/bin/uchiwa $out/bin/uchiwa \
      --add-flags "-p $out/public"
    ln -s ${backend.out}/index.html $out/public/index.html
    ln -s ${frontend.out}/bower_components $out/public/bower_components
  '';

  meta = with stdenv.lib; {
    description = "A Dashboard for the sensu monitoring framework";
    homepage    = http://sensuapp.org/;
    license     = licenses.mit;
    maintainers = with maintainers; [ peterhoeg ];
    platforms   = platforms.unix;
  };
}