mongodb-tools: extracted from goPackages

This commit is contained in:
Kamil Chmielewski 2016-06-03 13:05:48 +02:00
parent 89a256e463
commit 387246080b
5 changed files with 88 additions and 22 deletions

View file

@ -88,5 +88,41 @@
"rev": "ef00b378c73f107bf44d5c9b69875255ce89b79a",
"sha256": "168dhvl0wqiac8xmy8mqkvspd7cq6vfjpj80zdnriwy169nykcyz"
}
},
{
"goPackagePath": "github.com/howeyc/gopass",
"fetch": {
"type": "git",
"url": "https://github.com/howeyc/gopass",
"rev": "2c70fa70727c953c51695f800f25d6b44abb368e",
"sha256": "152lrkfxk205rlxiign0w5wb0fmfh910yz4jhlv4f4l1qr1h2lx8"
}
},
{
"goPackagePath": "github.com/jessevdk/go-flags",
"fetch": {
"type": "git",
"url": "https://github.com/jessevdk/go-flags",
"rev": "97448c91aac742cbca3d020b3e769013a420a06f",
"sha256": "0fv3yxvq8m3639a279hq4pf0c52ngqfl5n1vklcfympndrb7zjzj"
}
},
{
"goPackagePath": "gopkg.in/mgo.v2",
"fetch": {
"type": "git",
"url": "https://gopkg.in/mgo.v2",
"rev": "c6a7dce14133ccac2dcac3793f1d6e2ef048503a",
"sha256": "0rg232q1bkq3y3kd5816hgk1jpf7i38aha5q5ia7j6p9xashz7vj"
}
},
{
"goPackagePath": "gopkg.in/tomb.v2",
"fetch": {
"type": "git",
"url": "https://gopkg.in/tomb.v2",
"rev": "14b3d72120e8d10ea6e6b7f87f7175734b1faab8",
"sha256": "1nza31jvkpka5431c4bdbirvjdy36b1b55sbzljqhqih25jrcjx5"
}
}
]

View file

@ -0,0 +1,39 @@
# This file was generated by go2nix.
{ stdenv, lib, goPackages, fetchgit, fetchhg, fetchbzr, fetchsvn }:
with goPackages;
let
tools = [
"bsondump" "mongodump" "mongoexport" "mongofiles" "mongoimport"
"mongooplog" "mongorestore" "mongostat" "mongotop"
];
in
buildGoPackage rec {
name = "mongo-tools-${version}";
version = "3.0.12";
rev = "r${version}";
goPackagePath = "github.com/mongodb/mongo-tools";
subPackages = map (t: t + "/main") tools;
src = fetchgit {
inherit rev;
url = "https://github.com/mongodb/mongo-tools";
sha256 = "142vxgniri1mfy2xmfgxhbdp6k6h8c5milv454krv1b51v43hsbm";
};
goDeps = ./deps.json;
# Mongodb incorrectly names all of their binaries main
# Let's work around this with our own installer
preInstall = ''
mkdir -p $bin/bin
'' + toString (map (t: ''
go install $goPackagePath/${t}/main
mv go/bin/main $bin/bin/${t}
''
) tools) + ''
rm -r go/bin
'';
}

View file

@ -0,0 +1,12 @@
[
{
"include": "../../../go-modules/libs.json",
"packages": [
"github.com/howeyc/gopass",
"github.com/jessevdk/go-flags",
"golang.org/x/crypto",
"gopkg.in/mgo.v2",
"gopkg.in/tomb.v2"
]
}
]

View file

@ -881,7 +881,7 @@ in
mcrypt = callPackage ../tools/misc/mcrypt { };
mongodb-tools = goPackages.mongo-tools.bin // { outputs = [ "bin" ]; };
mongodb-tools = (callPackage ../tools/misc/mongodb-tools { }).bin;
mstflint = callPackage ../tools/misc/mstflint { };

View file

@ -2536,27 +2536,6 @@ let
buildInputs = [ toml ];
};
mongo-tools = buildFromGitHub {
rev = "4fcfd3e57415de95c0c016def07b95bca63cccb4";
owner = "mongodb";
repo = "mongo-tools";
sha256 = "0rm7bnb81hr0byxhvagwv8an1bky882nz68cmm2kbznzyprvhyaa";
buildInputs = [ gopass go-flags mgo openssl tomb ];
excludedPackages = "vendor";
# Mongodb incorrectly names all of their binaries main
# Let's work around this with our own installer
preInstall = ''
mkdir -p $bin/bin
while read b; do
rm -f go/bin/main
go install $goPackagePath/$b/main
cp go/bin/main $bin/bin/$b
done < <(find go/src/$goPackagePath -name main | xargs dirname | xargs basename -a)
rm -r go/bin
'';
};
motion = buildFromGitHub {
rev = "e09baac69ad86bff1de868e8d6c4327eb0a918d7";
owner = "fatih";