From 04a0e8802936173371ac3e940d9aa08f760077ec Mon Sep 17 00:00:00 2001 From: huangyi Date: Fri, 16 Feb 2024 15:09:14 +0800 Subject: [PATCH] Problem: fail to build in recent nixpkgs Solution: - fix the expression Update default.nix Signed-off-by: yihuang fix lint --- default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index b2c8102c6..72d04fcbb 100644 --- a/default.nix +++ b/default.nix @@ -49,10 +49,11 @@ buildGoApplication rec { buildFlags = lib.optionalString coverage "-cover"; buildInputs = lib.lists.optional (rocksdb != null) rocksdb; CGO_ENABLED = "1"; - CGO_LDFLAGS = + CGO_LDFLAGS = lib.optionalString (rocksdb != null) ( if static then "-lrocksdb -pthread -lstdc++ -ldl -lzstd -lsnappy -llz4 -lbz2 -lz" else if stdenv.hostPlatform.isWindows then "-lrocksdb-shared" - else "-lrocksdb -pthread -lstdc++ -ldl"; + else "-lrocksdb -pthread -lstdc++ -ldl" + ); tags = [ "cgo" "ledger" @@ -69,8 +70,8 @@ buildGoApplication rec { -X github.com/cosmos/cosmos-sdk/version.Commit=${rev} -X github.com/cosmos/cosmos-sdk/version.BuildTags=${concatStringsSep "," tags} ''; - postFixup = lib.optionalString stdenv.isDarwin '' - ${stdenv.cc.targetPrefix}install_name_tool -change "@rpath/librocksdb.8.dylib" "${rocksdb}/lib/librocksdb.dylib" $out/bin/chain-maind + postFixup = lib.optionalString (stdenv.isDarwin && rocksdb != null) '' + ${stdenv.cc.bintools.targetPrefix}install_name_tool -change "@rpath/librocksdb.8.dylib" "${rocksdb}/lib/librocksdb.dylib" $out/bin/chain-maind ''; passthru = { # update script use the same golang version as the project