diff --git a/helper/electrs-get-sha256.sh b/helper/electrs-get-sha256.sh new file mode 100755 index 000000000..7e86fa2b3 --- /dev/null +++ b/helper/electrs-get-sha256.sh @@ -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 )" + diff --git a/pkgs/electrs/default.nix b/pkgs/electrs/default.nix index 512d0b7ae..2fcd40f97 100644 --- a/pkgs/electrs/default.nix +++ b/pkgs/electrs/default.nix @@ -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 @@ -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";