Skip to content

Commit

Permalink
vouch: remove duplication
Browse files Browse the repository at this point in the history
If we want to maintain multiple versions of packages, how do we reduce
the duplication of definitions?
  • Loading branch information
zimbatm committed Feb 19, 2024
1 parent e05b9bc commit a354f77
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 50 deletions.
35 changes: 35 additions & 0 deletions pkgs/vouch/builder.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
buildGoModule,
mcl,
bls,
}: {
version,
src,
vendorHash,
...
} @ attrs: let
builder = buildGoModule ({
# Needed otherwise deadnix removes the keys as a requirement for the
# function call
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;
}
// attrs);
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=";
}

0 comments on commit a354f77

Please sign in to comment.