Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vouch: remove duplication #476

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions pkgs/vouch/builder.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
buildGoModule,
mcl,
bls,
}: let
builder = {
version,
src,
vendorHash,
}: overrides: let
originalAttrs = {
inherit version src vendorHash;

pname = "vouch";

runVend = true;

buildInputs = [mcl bls];

doCheck = false;

meta = {
description = "An Ethereum 2 multi-node validator client";
homepage = "https://github.com/attestantio/vouch";
mainProgram = "vouch";
platforms = ["x86_64-linux"];
};

passthru.mkPackage = builder;
};

overridesType = builtins.typeOf overrides;

buildAttrs =
if overridesType == "set"
then originalAttrs // overrides
else if overridesType == "lambda"
then originalAttrs // (overrides originalAttrs)
else throw "unsupported type '${overridesType}' for the overrides";
in
buildGoModule buildAttrs;
in
builder
39 changes: 14 additions & 25 deletions pkgs/vouch/default.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
{
buildGoModule,
callPackage,
fetchFromGitHub,
mcl,
bls,
}:
buildGoModule rec {
pname = "vouch";
version = "1.7.6";
}: let
mkVouch = callPackage ./builder.nix {inherit mcl bls;};
in
mkVouch rec {
version = "1.7.6";

src = fetchFromGitHub {
owner = "attestantio";
repo = pname;
rev = "v${version}";
hash = "sha256-zno/8uUkejS0zqOijGZdzknafavbvCU72uj/44on1f8=";
};
src = fetchFromGitHub {
owner = "attestantio";
repo = "vouch";
rev = "v${version}";
hash = "sha256-zno/8uUkejS0zqOijGZdzknafavbvCU72uj/44on1f8=";
};

runVend = true;
vendorHash = "sha256-zNHLg/nIKvIbMZtyDANxEQ04dygFHxwrM3JJkD1zcjo=";

buildInputs = [mcl bls];

doCheck = false;

meta = {
description = "An Ethereum 2 multi-node validator client";
homepage = "https://github.com/attestantio/vouch";
mainProgram = "vouch";
platforms = ["x86_64-linux"];
};
}
vendorHash = "sha256-zNHLg/nIKvIbMZtyDANxEQ04dygFHxwrM3JJkD1zcjo=";
} {}
39 changes: 14 additions & 25 deletions pkgs/vouch/unstable.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
{
buildGoModule,
callPackage,
fetchFromGitHub,
mcl,
bls,
}:
buildGoModule rec {
pname = "vouch";
version = "1.8.0-beta.3";
}: let
mkVouch = callPackage ./builder.nix {inherit mcl bls;};
in
mkVouch rec {
version = "1.8.0-beta.3";

src = fetchFromGitHub {
owner = "attestantio";
repo = pname;
rev = "v${version}";
hash = "sha256-CK6cLXJYMQL+ZRv8bYabgQ0GeDWK8Jcek6d/Wow2LI0=";
};
src = fetchFromGitHub {
owner = "attestantio";
repo = "vouch";
rev = "v${version}";
hash = "sha256-CK6cLXJYMQL+ZRv8bYabgQ0GeDWK8Jcek6d/Wow2LI0=";
};

runVend = true;
vendorHash = "sha256-Mp+RA2L4mOe089ceyKh3m5Q8zLsdwyx6geMFrqbn5Dk=";

buildInputs = [mcl bls];

doCheck = false;

meta = {
description = "An Ethereum 2 multi-node validator client";
homepage = "https://github.com/attestantio/vouch";
mainProgram = "vouch";
platforms = ["x86_64-linux"];
};
}
vendorHash = "sha256-Mp+RA2L4mOe089ceyKh3m5Q8zLsdwyx6geMFrqbn5Dk=";
} {}