Skip to content

Commit

Permalink
Get electrs source tarball with gpg verified sha256 and corresponding…
Browse files Browse the repository at this point in the history
… helper script
  • Loading branch information
nixbitcoin committed Apr 14, 2020
1 parent 1131c79 commit 0862277
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
25 changes: 25 additions & 0 deletions helper/electrs-get-sha256.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p git gnupg curl dirmngr
set -e

# Creating temporary directory
echo "Creating temporary directory"
DIR="$(mktemp -d)"
cd $DIR
git clone https://github.com/romanz/electrs 2> /dev/null

# Checking out latest release
echo "Checking out latest release"
cd electrs
latesttagelectrs=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest release is ${latesttagelectrs}"

# GPG Verification
export GNUPGHOME=$DIR
gpg2 --fetch-key https://keybase.io/romanz/pgp_keys.asc?fingerprint=15c8c3574ae4f1e25f3f35c587cae5fa46917cbb
echo "Verifying latest release"
git verify-tag ${latesttagelectrs}

# Calculating sha256
echo "sha256 for ${latesttagelectrs} is $(git archive --format tar.gz --prefix=electrs-"${latesttagelectrs//v}"/ ${latesttagelectrs} | sha256sum )"

16 changes: 10 additions & 6 deletions pkgs/electrs/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{ lib, rustPlatform, clang, llvmPackages, fetchFromGitHub, pkgs }:
{ lib, rustPlatform, clang, llvmPackages, fetchurl, pkgs }:
rustPlatform.buildRustPackage rec {
pname = "electrs";
version = "0.8.3";

src = fetchFromGitHub {
owner = "romanz";
repo = "electrs";
rev = "v${version}";
sha256 = "01993iv3kkf56s5x33gvk433zjwvqlfxa5vqrjl4ghr4i303ysc2";
src = fetchurl {
url = "https://github.com/romanz/electrs/archive/v${version}.tar.gz";
sha256 = "6a00226907a0c36b10884e7dd9f87eb58123f089977a752b917d166af072ea3d";
};

# Needed for librocksdb-sys
Expand All @@ -21,6 +19,12 @@ rustPlatform.buildRustPackage rec {
# for recent nixpkgs with cargo-native vendoring (introduced in nixpkgs PR #69274)
"1x88zj7p4i7pfb25ch1a54sawgimq16bfcsz1nmzycc8nbwbf493";

# N.B. The cargo depfile checker expects us to have unpacked the src tarball
# into the standard dirname "source".
cargoDepsHook = ''
ln -s ${pname}-${version} source
'';

meta = with lib; {
description = "An efficient Electrum Server in Rust";
homepage = "https://github.com/romanz/electrs";
Expand Down

0 comments on commit 0862277

Please sign in to comment.