|
1 | | -{ lib |
2 | | -, stdenv |
3 | | -, buildGoApplication |
4 | | -, nix-gitignore |
5 | | -, buildPackages |
6 | | -, coverage ? false # https://tip.golang.org/doc/go1.20#cover |
7 | | -, rocksdb |
8 | | -, network ? "mainnet" # mainnet|testnet |
9 | | -, rev ? "dirty" |
10 | | -, static ? stdenv.hostPlatform.isStatic |
11 | | -, nativeByteOrder ? true # nativeByteOrder mode will panic on big endian machines |
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + buildGoApplication, |
| 5 | + nix-gitignore, |
| 6 | + buildPackages, |
| 7 | + coverage ? false, # https://tip.golang.org/doc/go1.20#cover |
| 8 | + rocksdb, |
| 9 | + network ? "mainnet", # mainnet|testnet |
| 10 | + rev ? "dirty", |
| 11 | + static ? stdenv.hostPlatform.isStatic, |
| 12 | + nativeByteOrder ? true, # nativeByteOrder mode will panic on big endian machines |
12 | 13 | }: |
13 | 14 | let |
14 | 15 | version = "v1.4.0"; |
15 | 16 | pname = "cronosd"; |
16 | | - tags = [ "ledger" "netgo" network "rocksdb" "grocksdb_no_link" "pebbledb" "objstore" ] ++ lib.optionals nativeByteOrder [ "nativebyteorder" ]; |
| 17 | + tags = [ |
| 18 | + "ledger" |
| 19 | + "netgo" |
| 20 | + network |
| 21 | + "rocksdb" |
| 22 | + "grocksdb_no_link" |
| 23 | + "pebbledb" |
| 24 | + "objstore" |
| 25 | + ] ++ lib.optionals nativeByteOrder [ "nativebyteorder" ]; |
17 | 26 | ldflags = lib.concatStringsSep "\n" ([ |
18 | 27 | "-X github.com/cosmos/cosmos-sdk/version.Name=cronos" |
19 | 28 | "-X github.com/cosmos/cosmos-sdk/version.AppName=${pname}" |
|
24 | 33 | buildInputs = [ rocksdb ]; |
25 | 34 | in |
26 | 35 | buildGoApplication rec { |
27 | | - inherit pname version buildInputs tags ldflags; |
28 | | - src = (nix-gitignore.gitignoreSourcePure [ |
29 | | - "/*" # ignore all, then add whitelists |
30 | | - "!/x/" |
31 | | - "!/app/" |
32 | | - "!/cmd/" |
33 | | - "!/client/" |
34 | | - "!/versiondb/" |
35 | | - "!/memiavl/" |
36 | | - "!/store/" |
37 | | - "!go.mod" |
38 | | - "!go.sum" |
39 | | - "!gomod2nix.toml" |
40 | | - ] ./.); |
| 36 | + inherit |
| 37 | + pname |
| 38 | + version |
| 39 | + buildInputs |
| 40 | + tags |
| 41 | + ldflags |
| 42 | + ; |
| 43 | + src = ( |
| 44 | + nix-gitignore.gitignoreSourcePure [ |
| 45 | + "/*" # ignore all, then add whitelists |
| 46 | + "!/x/" |
| 47 | + "!/app/" |
| 48 | + "!/cmd/" |
| 49 | + "!/client/" |
| 50 | + "!/versiondb/" |
| 51 | + "!/memiavl/" |
| 52 | + "!/store/" |
| 53 | + "!go.mod" |
| 54 | + "!go.sum" |
| 55 | + "!gomod2nix.toml" |
| 56 | + ] ./. |
| 57 | + ); |
41 | 58 | modules = ./gomod2nix.toml; |
42 | 59 | pwd = src; # needed to support replace |
43 | 60 | subPackages = [ "cmd/cronosd" ]; |
44 | 61 | buildFlags = lib.optionalString coverage "-cover"; |
45 | 62 | CGO_ENABLED = "1"; |
46 | 63 | CGO_LDFLAGS = lib.optionalString (rocksdb != null) ( |
47 | | - if static then "-lrocksdb -pthread -lstdc++ -ldl -lzstd -lsnappy -llz4 -lbz2 -lz" |
48 | | - else if stdenv.hostPlatform.isWindows then "-lrocksdb-shared" |
49 | | - else "-lrocksdb -pthread -lstdc++ -ldl" |
| 64 | + if static then |
| 65 | + "-lrocksdb -pthread -lstdc++ -ldl -lzstd -lsnappy -llz4 -lbz2 -lz" |
| 66 | + else if stdenv.hostPlatform.isWindows then |
| 67 | + "-lrocksdb-shared" |
| 68 | + else |
| 69 | + "-lrocksdb -pthread -lstdc++ -ldl" |
50 | 70 | ); |
51 | 71 |
|
52 | 72 | postFixup = lib.optionalString (stdenv.isDarwin && rocksdb != null) '' |
|
0 commit comments