forked from crypto-org-chain/cronos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
50 lines (49 loc) · 1.45 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
{ lib
, buildGoApplication
, nix-gitignore
, rocksdb ? null
, db_backend ? "rocksdb"
, network ? "mainnet" # mainnet|testnet
, rev ? "dirty"
}:
let
version = "v0.8.0";
pname = "cronosd";
tags = [ "ledger" "netgo" network ]
++ lib.lists.optional (db_backend == "rocksdb") "rocksdb";
ldflags = lib.concatStringsSep "\n" ([
"-X github.com/cosmos/cosmos-sdk/version.Name=cronos"
"-X github.com/cosmos/cosmos-sdk/version.AppName=${pname}"
"-X github.com/cosmos/cosmos-sdk/version.Version=${version}"
"-X github.com/cosmos/cosmos-sdk/version.BuildTags=${lib.concatStringsSep "," tags}"
"-X github.com/cosmos/cosmos-sdk/version.Commit=${rev}"
] ++ lib.lists.optionals (db_backend == "rocksdb") [
"-X github.com/cosmos/cosmos-sdk/types.DBBackend=rocksdb"
]);
buildInputs = lib.lists.optionals (db_backend == "rocksdb") [
rocksdb
];
in
buildGoApplication rec {
inherit pname version buildInputs tags ldflags;
src = (nix-gitignore.gitignoreSourcePure [
"/*" # ignore all, then add whitelists
"!/x/"
"!/app/"
"!/cmd/"
"!/client/"
"!go.mod"
"!go.sum"
"!gomod2nix.toml"
] ./.);
modules = ./gomod2nix.toml;
pwd = src; # needed to support replace
subPackages = [ "cmd/cronosd" ];
CGO_ENABLED = "1";
meta = with lib; {
description = "Official implementation of the Cronos blockchain protocol";
homepage = "https://cronos.org/";
license = licenses.asl20;
mainProgram = "cronosd";
};
}