From df097fe2c3e034956b4beb2fc0620823793704b2 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Wed, 4 Feb 2015 13:41:31 +0100 Subject: [PATCH] Fix and port bosun and scollector to buildGoPackage --- pkgs/servers/monitoring/bosun/default.nix | 39 +++++++------------ pkgs/servers/monitoring/bosun/scollector.nix | 41 ++++++++------------ 2 files changed, 31 insertions(+), 49 deletions(-) diff --git a/pkgs/servers/monitoring/bosun/default.nix b/pkgs/servers/monitoring/bosun/default.nix index b6a6ef8f3bb7..bbe92bd1329b 100644 --- a/pkgs/servers/monitoring/bosun/default.nix +++ b/pkgs/servers/monitoring/bosun/default.nix @@ -1,29 +1,20 @@ -{ stdenv, fetchurl, go }: -stdenv.mkDerivation rec { - name = "bosun-${version}"; - version = "20141215200935"; - src = fetchurl { - url = "https://github.com/bosun-monitor/bosun/archive/${version}.tar.gz"; - sha256 = "1py4plx5wi4mp05g4c1aa1wa8ny538kp2p4fzhalz33zm2qxbbx9"; +{ lib, fetchFromGitHub, goPackages }: + +with goPackages; + +buildGoPackage rec { + rev = "20150202222550"; + name = "bosun-${rev}"; + goPackagePath = "bosun.org"; + src = fetchFromGitHub { + inherit rev; + owner = "bosun-monitor"; + repo = "bosun"; + sha256 = "0xrnyq85nxj6rddrhd19r2bz59pzxci6bnjh61j4z8hd6ryp8j2c"; }; - buildInputs = [ go ]; + subPackages = [ "cmd/bosun" ]; - sourceRoot = "."; - - buildPhase = '' - mkdir -p src - mv bosun-${version} src/bosun.org - - export GOPATH=$PWD - go build -v -o bosun src/bosun.org/cmd/bosun/main.go - ''; - - installPhase = '' - mkdir -p $out/bin - cp bosun $out/bin - ''; - - meta = with stdenv.lib; { + meta = with lib; { description = "Time series alerting framework"; longDescription = '' An advanced, open-source monitoring and alerting system by Stack Exchange. diff --git a/pkgs/servers/monitoring/bosun/scollector.nix b/pkgs/servers/monitoring/bosun/scollector.nix index 176d42d382a2..f7e5c99c91de 100644 --- a/pkgs/servers/monitoring/bosun/scollector.nix +++ b/pkgs/servers/monitoring/bosun/scollector.nix @@ -1,32 +1,23 @@ -{ stdenv, fetchurl, go }: -stdenv.mkDerivation rec { - name = "scollector-${version}"; - version = "20141204222654"; - src = fetchurl { - url = "https://github.com/bosun-monitor/bosun/archive/${version}.tar.gz"; - sha256 = "1jwhfwf24zhncrirna3q1vhap4f955bqx3sws3ryk5gp1w99l36n"; +{ lib, fetchFromGitHub, goPackages }: + +with goPackages; + +buildGoPackage rec { + rev = "20150202222550"; + name = "bosun-${rev}"; + goPackagePath = "bosun.org"; + src = fetchFromGitHub { + inherit rev; + owner = "bosun-monitor"; + repo = "bosun"; + sha256 = "0xrnyq85nxj6rddrhd19r2bz59pzxci6bnjh61j4z8hd6ryp8j2c"; }; - buildInputs = [ go ]; + subPackages = [ "cmd/scollector" ]; - sourceRoot = "."; - - buildPhase = '' - mkdir -p src - mv bosun-${version} src/bosun.org - - export GOPATH=$PWD - go build -v -o scollector src/bosun.org/cmd/scollector/main.go - ''; - - installPhase = '' - mkdir -p $out/bin - cp scollector $out/bin - ''; - - meta = with stdenv.lib; { + meta = with lib; { description = "Collect system information and store it in OpenTSDB or Bosun"; homepage = http://bosun.org/scollector; license = licenses.mit; - platforms = stdenv.lib.platforms.linux; + platforms = platforms.linux; }; }