summary refs log tree commit diff
path: root/pkgs/servers/nsq/default.nix
blob: b1570d96c7b6a9bda76b3f4fb1b117f7aa12714b (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
{ stdenv, lib, go, fetchurl, fetchgit, fetchhg, fetchbzr, fetchFromGitHub }:

stdenv.mkDerivation rec {
  version = "0.2.28";
  name = "nsq-${version}";

  src = import ./deps.nix {
    inherit stdenv lib fetchgit fetchhg fetchbzr fetchFromGitHub;
  };

  buildInputs = [ go ];

  buildPhase = ''
    export GOPATH=$src
    apps=(nsq_pubsub nsq_stat nsq_tail nsq_to_file nsq_to_http nsq_to_nsq nsqd nsqlookupd)

    mkdir build

    go build -v -o build/nsqadmin github.com/bitly/nsq/nsqadmin
    for app in "''${apps[@]}"; do
      go build -v -o build/$app github.com/bitly/nsq/apps/$app
    done
  '';

  installPhase = ''
    ensureDir $out/bin
    mv build/* $out/bin
  '';

  meta = with stdenv.lib; {
    description = "A realtime distributed messaging platform";
    homepage = http://nsq.io/;
    license = licenses.mit;
    maintainers = with maintainers; [ cstrahan ];
    platforms = platforms.unix;
  };
}