2017-07-21 16:45:03 +01:00
|
|
|
{ stdenv, buildGoPackage, fetchFromGitHub }:
|
|
|
|
|
|
|
|
buildGoPackage rec {
|
|
|
|
name = "dgraph-${version}";
|
2017-09-27 20:44:51 +01:00
|
|
|
version = "0.8.2";
|
2017-07-21 16:45:03 +01:00
|
|
|
|
|
|
|
goPackagePath = "github.com/dgraph-io/dgraph";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dgraph-io";
|
|
|
|
repo = "dgraph";
|
|
|
|
rev = "v${version}";
|
2017-09-27 20:44:51 +01:00
|
|
|
sha256 = "0zc5bda8m2srjbk0gy1nnm0bya8if0kmk1szqr1qv3xifdzmi4nf";
|
2017-07-21 16:45:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extraOutputsToInstall = [ "dashboard" ];
|
|
|
|
|
|
|
|
goDeps = ./deps.nix;
|
2017-09-27 20:44:51 +01:00
|
|
|
subPackages = [ "cmd/dgraph" "cmd/dgraphloader" "cmd/bulkloader"];
|
2017-07-21 16:45:03 +01:00
|
|
|
|
|
|
|
# let's move the dashboard to a different output, to prevent $bin from
|
|
|
|
# depending on $out
|
|
|
|
# TODO: provide a proper npm application for the dashboard.
|
|
|
|
postPatch = ''
|
|
|
|
mv dashboard/* $dashboard
|
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export buildFlagsArray="-ldflags=\
|
|
|
|
-X github.com/dgraph-io/dgraph/x.dgraphVersion=${version} \
|
|
|
|
-X github.com/dgraph-io/dgraph/cmd/dgraph/main.uiDir=$dashboard/src/assets/"
|
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Somehow on Darwin, $out/lib (which doesn't exist) ends up in RPATH.
|
|
|
|
# Removing it fixes cycle between $out and $bin
|
|
|
|
install_name_tool -delete_rpath $out/lib $bin/bin/dgraph
|
|
|
|
install_name_tool -delete_rpath $out/lib $bin/bin/dgraphloader
|
2017-09-27 20:44:51 +01:00
|
|
|
install_name_tool -delete_rpath $out/lib $bin/bin/bulkloader
|
2017-07-21 16:45:03 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://dgraph.io/";
|
|
|
|
description = "Fast, Distributed Graph DB";
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ sigma ];
|
|
|
|
license = stdenv.lib.licenses.agpl3;
|
|
|
|
platforms = stdenv.lib.platforms.unix;
|
|
|
|
};
|
|
|
|
}
|