etcd_3_5: refactor
- use inherits and add passthru
This commit is contained in:
parent
a20768bca1
commit
e1ea38626f
1 changed files with 18 additions and 25 deletions
|
@ -1,15 +1,18 @@
|
||||||
{ lib, buildGoModule, fetchFromGitHub, symlinkJoin }:
|
{ lib, buildGoModule, fetchFromGitHub, symlinkJoin }:
|
||||||
|
|
||||||
let
|
let
|
||||||
etcdVersion = "3.5.4";
|
version = "3.5.4";
|
||||||
etcdSrc = fetchFromGitHub {
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
owner = "etcd-io";
|
owner = "etcd-io";
|
||||||
repo = "etcd";
|
repo = "etcd";
|
||||||
rev = "v${etcdVersion}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-mTQHxLLfNiihvHg5zaTeVNWKuzvE0KBiJdY3qMJHMCM=";
|
sha256 = "sha256-mTQHxLLfNiihvHg5zaTeVNWKuzvE0KBiJdY3qMJHMCM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
commonMeta = with lib; {
|
CGO_ENABLED = 0;
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
description = "Distributed reliable key-value store for the most critical data of a distributed system";
|
description = "Distributed reliable key-value store for the most critical data of a distributed system";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
homepage = "https://etcd.io/";
|
homepage = "https://etcd.io/";
|
||||||
|
@ -19,60 +22,50 @@ let
|
||||||
|
|
||||||
etcdserver = buildGoModule rec {
|
etcdserver = buildGoModule rec {
|
||||||
pname = "etcdserver";
|
pname = "etcdserver";
|
||||||
version = etcdVersion;
|
|
||||||
|
inherit CGO_ENABLED meta src version;
|
||||||
|
|
||||||
vendorSha256 = "sha256-4djUQvWp9hScua9l1ZTq298zWSeDYRDojEt2AWmarzw=";
|
vendorSha256 = "sha256-4djUQvWp9hScua9l1ZTq298zWSeDYRDojEt2AWmarzw=";
|
||||||
|
|
||||||
src = etcdSrc;
|
|
||||||
modRoot = "./server";
|
modRoot = "./server";
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
mv $GOPATH/bin/{server,etcd}
|
mv $GOPATH/bin/{server,etcd}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
CGO_ENABLED = 0;
|
|
||||||
|
|
||||||
# We set the GitSHA to `GitNotFound` to match official build scripts when
|
# We set the GitSHA to `GitNotFound` to match official build scripts when
|
||||||
# git is unavailable. This is to avoid doing a full Git Checkout of etcd.
|
# git is unavailable. This is to avoid doing a full Git Checkout of etcd.
|
||||||
# User facing version numbers are still available in the binary, just not
|
# User facing version numbers are still available in the binary, just not
|
||||||
# the sha it was built from.
|
# the sha it was built from.
|
||||||
ldflags = [ "-X go.etcd.io/etcd/api/v3/version.GitSHA=GitNotFound" ];
|
ldflags = [ "-X go.etcd.io/etcd/api/v3/version.GitSHA=GitNotFound" ];
|
||||||
|
|
||||||
meta = commonMeta;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
etcdutl = buildGoModule rec {
|
etcdutl = buildGoModule rec {
|
||||||
pname = "etcdutl";
|
pname = "etcdutl";
|
||||||
version = etcdVersion;
|
|
||||||
|
inherit CGO_ENABLED meta src version;
|
||||||
|
|
||||||
vendorSha256 = "sha256-nk56XGpNsDwcGrTKithKGnPCX0NhpQmzNSXHk3vmdtg=";
|
vendorSha256 = "sha256-nk56XGpNsDwcGrTKithKGnPCX0NhpQmzNSXHk3vmdtg=";
|
||||||
|
|
||||||
src = etcdSrc;
|
|
||||||
modRoot = "./etcdutl";
|
modRoot = "./etcdutl";
|
||||||
|
|
||||||
CGO_ENABLED = 0;
|
|
||||||
|
|
||||||
meta = commonMeta;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
etcdctl = buildGoModule rec {
|
etcdctl = buildGoModule rec {
|
||||||
pname = "etcdctl";
|
pname = "etcdctl";
|
||||||
version = etcdVersion;
|
|
||||||
|
inherit CGO_ENABLED meta src version;
|
||||||
|
|
||||||
vendorSha256 = "sha256-WIMYrXfay6DMz+S/tIc/X4ffMizxub8GS1DDgIR40D4=";
|
vendorSha256 = "sha256-WIMYrXfay6DMz+S/tIc/X4ffMizxub8GS1DDgIR40D4=";
|
||||||
|
|
||||||
src = etcdSrc;
|
|
||||||
modRoot = "./etcdctl";
|
modRoot = "./etcdctl";
|
||||||
|
|
||||||
CGO_ENABLED = 0;
|
|
||||||
|
|
||||||
meta = commonMeta;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
symlinkJoin {
|
symlinkJoin {
|
||||||
name = "etcd";
|
name = "etcd-${version}";
|
||||||
version = etcdVersion;
|
|
||||||
meta = commonMeta;
|
inherit meta version;
|
||||||
|
|
||||||
|
passthru = { inherit etcdserver etcdutl etcdctl; };
|
||||||
|
|
||||||
paths = [
|
paths = [
|
||||||
etcdserver
|
etcdserver
|
||||||
|
|
Loading…
Reference in a new issue