diff --git a/pkgs/servers/serfdom/default.nix b/pkgs/servers/serfdom/default.nix index 274fc89f94d0..40b41c8f9d39 100644 --- a/pkgs/servers/serfdom/default.nix +++ b/pkgs/servers/serfdom/default.nix @@ -1,126 +1,30 @@ -{ stdenv, fetchurl, fetchgit, fetchhg, go, lib }: +{ stdenv, lib, go, fetchurl, fetchgit, fetchhg, fetchbzr, fetchFromGitHub }: -let - goDeps = [ - { - dir = "github.com/hashicorp"; - name = "serf"; - rev = "c5b41a9d1d261135117a8d501d3293efade3cc74"; - sha256 = "a314d3c13fb370842a8f7c6650abfa907b51172a09c64f9184a240fab05b43df"; - fetcher = git; - } - { - dir = "github.com/armon"; - name = "go-metrics"; - rev = "e12c3591b520e819e8234bd585d592774f2b2ad5"; - sha256 = "79476efefb68876fcad7e71e76d95f4a7eece2cfcdc5a9c10f998af3178230ba"; - fetcher = git; - } - { - dir = "github.com/hashicorp"; - name = "logutils"; - rev = "8e0820fe7ac5eb2b01626b1d99df47c5449eb2d8"; - sha256 = "184lnn7x1v3xvj6zz1rg9s0252wkkd59kij2iyrrm7y80bym2jys"; - fetcher = git; - } - { - dir = "github.com/hashicorp"; - name = "memberlist"; - rev = "d5be01d1f4d75b086eba4ae808f2767c08cbbf73"; - sha256 = "4ab2b610d439e96c169d9caf9ac0e009d71d3ef9a2fd2c812870b71eb6b27dfc"; - fetcher = git; - } - { - dir = "github.com/ugorji"; - name = "go"; - rev = "71c2886f5a673a35f909803f38ece5810165097b"; - sha256 = "128853bcc5f114c300772cbce316b55e84206fa56705c5b9cc94c1693b11ee94"; - fetcher = git; - } - { - dir = "github.com/mitchellh"; - name = "cli"; - rev = "69f0b65ce53b27f729b1b807b88dc88007f41dd3"; - sha256 = "0hnnqd8vg5ca2hglkrj141ba2akdh7crl2lsrgz8d6ipw6asszx3"; - fetcher = git; - } - { - dir = "github.com/armon"; - name = "mdns"; - rev = "8be7e3ac4e941555169a99d01abcabd3c982d87a"; - sha256 = "87cd3a0ada3b094ee8fc4c4742158e0d051cde893da1ea320158a47d6254f69d"; - fetcher = git; - } - { - dir = "github.com/miekg"; - name = "dns"; - rev = "7ebb4c59b39d5984952a355086606dd91f6cfe86"; - sha256 = "8418ad2d27e607cef1dc0003471416294443e467f2de9df135e3a2ab411e2512"; - fetcher = git; - } - { - dir = "github.com/mitchellh"; - name = "mapstructure"; - rev = "57bb2fa7a7e00b26c80e4c4b0d4f15a210d94039"; - sha256 = "13lvd5vw8y6h5zl3samkrb7237kk778cky7k7ys1cm46mfd957zy"; - fetcher = git; - } - { - dir = "github.com/ryanuber"; - name = "columnize"; - rev = "d066e113d6e13232f45bda646a915dffeee7f1a4"; - sha256 = "2aaec396a223fc4b45117a595e74c0a874bd5cd9604c742b8c4747436b4721e9"; - fetcher = git; - } - { - dir = "code.google.com/p"; - name = "go.net"; - rev = "89dbba2db2d4"; - sha256 = "0168inai10nkdrz4g0rjlj8b5v34mv135v8bhyvh501vnqql50jn"; - fetcher = hg; - } - ]; - git = desc: fetchgit { url = "https://${desc.dir}/${desc.name}"; - inherit (desc) rev sha256; }; - hg = desc: fetchhg { url = "https://${desc.dir}/${desc.name}"; - tag = desc.rev; - inherit (desc) sha256; }; - createGoPathCmds = - lib.concatStrings - (map (desc: - let fetched = desc.fetcher desc; in '' - mkdir -p $GOPATH/src/${desc.dir} - ln -s ${fetched} $GOPATH/src/${desc.dir}/${desc.name} - '') goDeps); -in - stdenv.mkDerivation rec { - version = "0.5.0"; - name = "serfdom-${version}"; +stdenv.mkDerivation rec { + version = "0.6.2"; + name = "serfdom-${version}"; - src = fetchurl { - url = "https://github.com/hashicorp/serf/archive/v${version}.tar.gz"; - sha256 = "1p2cpkdx0gck1ypxc98im7gsv3275avpkizhsif3nxvl1xd8g1qp"; - }; + src = import ./deps.nix { + inherit stdenv lib fetchgit fetchhg fetchbzr fetchFromGitHub; + }; - buildInputs = [ go ]; + buildInputs = [ go ]; - buildPhase = '' - mkdir $TMPDIR/go - export GOPATH=$TMPDIR/go - ${createGoPathCmds} - go build -v -o bin/serf - ''; + buildPhase = '' + export GOPATH=$src + go build -v -o serf github.com/hashicorp/serf + ''; - installPhase = '' - ensureDir $out/bin - cp bin/serf $out/bin - ''; + installPhase = '' + ensureDir $out/bin + mv serf $out/bin/serf + ''; - meta = with stdenv.lib; { - description = "Serf is a service discovery and orchestration tool that is decentralized, highly available, and fault tolerant"; - homepage = http://www.serfdom.io/; - license = licenses.mpl20; - maintainers = [ maintainers.msackman ]; - platforms = platforms.linux; - }; - } + meta = with stdenv.lib; { + description = "Serf is a service discovery and orchestration tool that is decentralized, highly available, and fault tolerant"; + homepage = http://www.serfdom.io/; + license = licenses.mpl20; + maintainers = with maintainers; [ msackman cstrahan ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/servers/serfdom/deps.nix b/pkgs/servers/serfdom/deps.nix new file mode 100644 index 000000000000..d4da74b54767 --- /dev/null +++ b/pkgs/servers/serfdom/deps.nix @@ -0,0 +1,185 @@ +{ stdenv, lib, fetchgit, fetchhg, fetchbzr, fetchFromGitHub }: + +let + goDeps = [ + { + root = "code.google.com/p/go.net"; + src = fetchhg { + url = "http://code.google.com/p/go.net"; + tag = "134"; + sha256 = "1jycpgrfwgkfac60zjbx6babcz7sgyn9xgy6cr3l811j6k8r2pbv"; + }; + } + { + root = "code.google.com/p/go.text"; + src = fetchhg { + url = "http://code.google.com/p/go.text"; + tag = "85"; + sha256 = "1x8h6vq9g5gbi7iiwla6dkaaqqf7wmkdm4szj7wvzlsijf2x8dwr"; + }; + } + { + root = "github.com/armon/circbuf"; + src = fetchFromGitHub { + owner = "armon"; + repo = "circbuf"; + rev = "f092b4f207b6e5cce0569056fba9e1a2735cb6cf"; + sha256 = "06kwwdwa3hskdh6ws7clj1vim80dyc3ldim8k9y5qpd30x0avn5s"; + }; + } + { + root = "github.com/armon/go-metrics"; + src = fetchFromGitHub { + owner = "armon"; + repo = "go-metrics"; + rev = "02567bbc4f518a43853d262b651a3c8257c3f141"; + sha256 = "08fk3zmw0ywmdfp2qhrpv0vrk1y97hzqczrgr3y2yip3x8sr37ar"; + }; + } + { + root = "github.com/armon/mdns"; + src = fetchFromGitHub { + owner = "armon"; + repo = "mdns"; + rev = "70462deb060d44247356ee238ebafd7699ddcffe"; + sha256 = "0xkm3d0hsixdm1yrkx9c39723kfjkb3wvrzrmx3np9ylcwn6h5p5"; + }; + } + { + root = "github.com/hashicorp/go-syslog"; + src = fetchFromGitHub { + owner = "hashicorp"; + repo = "go-syslog"; + rev = "ac3963b72ac367e48b1e68a831e62b93fb69091c"; + sha256 = "1r9s1gsa4azcs05gx1179ixk7qvrkrik3v92wr4s8gwm00m0gf81"; + }; + } + { + root = "github.com/hashicorp/logutils"; + src = fetchFromGitHub { + owner = "hashicorp"; + repo = "logutils"; + rev = "8e0820fe7ac5eb2b01626b1d99df47c5449eb2d8"; + sha256 = "033rbkc066g657r0dnzysigjz2bs4biiz0kmiypd139d34jvslwz"; + }; + } + { + root = "github.com/hashicorp/memberlist"; + src = fetchFromGitHub { + owner = "hashicorp"; + repo = "memberlist"; + rev = "17d39b695094be943bfb98442a80b082e6b9ac47"; + sha256 = "0nvgjnwmfqhv2wvr77d2q5mq1bfw4xbpil6wgyj4fyrmhsfzrv3g"; + }; + } + { + root = "github.com/hashicorp/serf"; + src = fetchFromGitHub { + owner = "hashicorp"; + repo = "serf"; + rev = "4232a3f7b52f755084caf6b2cc2789efa2948555"; + sha256 = "1hxxqrjz08882d205ylakhvvwciahiqdzkwi2a7zwrmx6sxna7sr"; + }; + } + { + root = "github.com/miekg/dns"; + src = fetchFromGitHub { + owner = "miekg"; + repo = "dns"; + rev = "fc67c4b981930a377f8a26a5a1f2c0ccd5dd1514"; + sha256 = "1csjmkx0gl34r4hmkhdbdxb0693f1p10yrjaj8f2jwli9p9sl4mg"; + }; + } + { + root = "github.com/mitchellh/cli"; + src = fetchFromGitHub { + owner = "mitchellh"; + repo = "cli"; + rev = "8262fe3f76f0da53b5674eb35c8c6436430794c3"; + sha256 = "0pqkxh1q49kkxihggrfjs8174d927g4c5qqx00ggw8sqqsgrw6vn"; + }; + } + { + root = "github.com/mitchellh/mapstructure"; + src = fetchFromGitHub { + owner = "mitchellh"; + repo = "mapstructure"; + rev = "6fb2c832bcac61d01212ab1d172f7a14a8585b07"; + sha256 = "0mx855lwhv0rk461wmbnbzbpkhmq5p2ipmrm5bhzimagrr1w17hw"; + }; + } + { + root = "github.com/ryanuber/columnize"; + src = fetchFromGitHub { + owner = "ryanuber"; + repo = "columnize"; + rev = "785d943a7b6886e0bb2f139a60487b823dd8d9de"; + sha256 = "1h3sxzhiwz65vf3cvclirlf6zhdr97v01dpn5cmf3m09rxxpnp3f"; + }; + } + { + root = "github.com/ugorji/go"; + src = fetchFromGitHub { + owner = "ugorji"; + repo = "go"; + rev = "71c2886f5a673a35f909803f38ece5810165097b"; + sha256 = "157f24xnkhclrjwwa1b7lmpj112ynlbf7g1cfw0c657iqny5720j"; + }; + } + { + root = "github.com/ugorji/go-msgpack"; + src = fetchFromGitHub { + owner = "ugorji"; + repo = "go-msgpack"; + rev = "75092644046c5e38257395b86ed26c702dc95b92"; + sha256 = "1bmqi16bfiqw7qhb3d5hbh0dfzhx2bbq1g15nh2pxwxckwh80x98"; + }; + } + { + root = "github.com/vmihailenco/bufio"; + src = fetchFromGitHub { + owner = "vmihailenco"; + repo = "bufio"; + rev = "24e7e48f60fc2d9e99e43c07485d9fff42051e66"; + sha256 = "0x46qnf2f15v7m0j2dcb16raxjamk5rdc7hqwgyxfr1sqmmw3983"; + }; + } + { + root = "github.com/vmihailenco/msgpack"; + src = fetchFromGitHub { + owner = "vmihailenco"; + repo = "msgpack"; + rev = "20c1b88a6c7fc5432037439f4e8c582e236fb205"; + sha256 = "1dj5scpfhgnw0yrh0w6jlrb9d03halvsv4l3wgjhazrrimdqf0q0"; + }; + } + { + root = "launchpad.net/gocheck"; + src = fetchbzr { + url = "https://launchpad.net/gocheck"; + revision = "87"; + sha256 = "1y9fa2mv61if51gpik9isls48idsdz87zkm1p3my7swjdix7fcl0"; + }; + } + { + root = "launchpad.net/mgo"; + src = fetchbzr { + url = "https://launchpad.net/mgo"; + revision = "2"; + sha256 = "0h1dxzyx5c4r4gfnmjxv92hlhjxrgx9p4g53p4fhmz6x2fdglb0x"; + }; + } + ]; + +in + +stdenv.mkDerivation rec { + name = "go-deps"; + + buildCommand = + lib.concatStrings + (map (dep: '' + mkdir -p $out/src/`dirname ${dep.root}` + ln -s ${dep.src} $out/src/${dep.root} + '') goDeps); +}