lnd: build with same feature tags as upstream

See: https://github.com/lightningnetwork/lnd/blob/v0.10.3-beta/make/release_flags.mk#L36

Also pass RawTags and GoVersion to build so that it
shows in e.g. "lncli version".
This commit is contained in:
Martin Milata 2020-06-06 17:45:57 +02:00
parent 8b6b000382
commit f800711aaa
1 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,6 @@
{ buildGoModule, fetchFromGitHub, lib }:
{ buildGoModule, fetchFromGitHub, lib
, tags ? [ "autopilotrpc" "signrpc" "walletrpc" "chainrpc" "invoicesrpc" "watchtowerrpc" ]
}:
buildGoModule rec {
pname = "lnd";
@ -15,6 +17,18 @@ buildGoModule rec {
subPackages = ["cmd/lncli" "cmd/lnd"];
preBuild = let
buildVars = {
RawTags = lib.concatStringsSep "," tags;
GoVersion = "$(go version | egrep -o 'go[0-9]+[.][^ ]*')";
};
buildVarsFlags = lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "-X github.com/lightningnetwork/lnd/build.${k}=${v}") buildVars);
in
lib.optionalString (tags != []) ''
buildFlagsArray+=("-tags=${lib.concatStringsSep " " tags}")
buildFlagsArray+=("-ldflags=${buildVarsFlags}")
'';
meta = with lib; {
description = "Lightning Network Daemon";
homepage = "https://github.com/lightningnetwork/lnd";