forked from SkygearIO/skygear-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
55 lines (45 loc) · 1.48 KB
/
default.nix
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
let pkgs = import <nixpkgs> {};
in
{ stdenv ? pkgs.stdenv
, buildGoPackage ? pkgs.buildGoPackage
, fetchgit ? pkgs.fetchgit
, libsodium ? pkgs.libsodium
, zeromq ? pkgs.zeromq
, czmq ? pkgs.czmq
, glide ? pkgs.glide
, git ? pkgs.git
, pkgconfig ? pkgs.pkgconfig
, withZMQ ? false }:
buildGoPackage rec {
name = "skygear";
goPackagePath = "github.com/skygeario/skygear-server";
# If you are doing development and want to build the current source:
src = ./.;
# If you are not doing development, just want to build a commit:
# Remember to update the hash / commit
# src = fetchgit {
# rev = "commit hash here";
# url = "[email protected]:SkygearIO/skygear-server.git";
# sha256 = "hash here";
# };
buildInputs = [ git glide ]
++ (if withZMQ then [ libsodium zeromq czmq pkgconfig ] else []);
buildFlags = if withZMQ then "--tags zmq" else "";
preBuild = ''
pushd "go/src/${goPackagePath}"
make vendor
popd
'';
# Workaround a bug of the binary creates cycle reference
# such that nix refuse to build.
# https://github.com/NixOS/nixpkgs/issues/18131
postInstall = if withZMQ then ''
install_name_tool -delete_rpath $out/lib -add_rpath $bin $bin/bin/skygear-server
'' else "";
# Need this for glide to download dependencies
SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
meta = {
homepage = "https://skygear.io";
license = stdenv.lib.licenses.asl20;
};
}