From fbe8f7c6cb3c359493a0f7511008cc09cc837eae Mon Sep 17 00:00:00 2001 From: neverupdate Date: Sat, 27 Aug 2022 01:14:52 -0300 Subject: [PATCH] trustedcoin: add pkg --- pkgs/default.nix | 1 + pkgs/trustedcoin/default.nix | 23 +++++++++++++++++++++++ pkgs/trustedcoin/get-sha256.sh | 20 ++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 pkgs/trustedcoin/default.nix create mode 100755 pkgs/trustedcoin/get-sha256.sh diff --git a/pkgs/default.nix b/pkgs/default.nix index ed7bc41..c57cfdc 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -20,6 +20,7 @@ let self = { # The secp256k1 version used by joinmarket secp256k1 = pkgs.callPackage ./secp256k1 { }; spark-wallet = pkgs.callPackage ./spark-wallet { }; + trustedcoin = pkgs.callPackage ./trustedcoin { }; pyPkgs = import ./python-packages self pkgs.python3; inherit (self.pyPkgs) diff --git a/pkgs/trustedcoin/default.nix b/pkgs/trustedcoin/default.nix new file mode 100644 index 0000000..4b4cb64 --- /dev/null +++ b/pkgs/trustedcoin/default.nix @@ -0,0 +1,23 @@ +{ lib, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "trustedcoin"; + version = "0.5.2"; + src = fetchFromGitHub { + owner = "nbd-wtf"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-s8zgY+TDABK96BehY+SVl86wCMd+e8BKdxw0kGV1jAI="; + }; + + vendorSha256 = "sha256-wpK5SW9nOMO/e4DoEk8LRxLykxYt06LoBBxjeEujOiU="; + + subPackages = [ "." ]; + + meta = with lib; { + description = "Light bitcoin node implementation"; + homepage = "https://github.com/nbd-wtf/trustedcoin"; + maintainers = with maintainers; [ seberm fort-nix ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/trustedcoin/get-sha256.sh b/pkgs/trustedcoin/get-sha256.sh new file mode 100755 index 0000000..212b671 --- /dev/null +++ b/pkgs/trustedcoin/get-sha256.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p git gnupg curl jq +set -euo pipefail + + +TMPDIR="$(mktemp -d -p /tmp)" +trap 'rm -rf $TMPDIR' EXIT +cd "$TMPDIR" + +echo "Fetching latest release" +repo='nbd-wtf/trustedcoin' +latest=$(curl --location --silent --show-error https://api.github.com/repos/${repo}/releases/latest | jq -r .tag_name) +echo "Latest release is $latest" +git clone --depth 1 --branch "$latest" "https://github.com/${repo}" 2>/dev/null +cd trustedcoin + +echo "tag: $latest" +git checkout -q "tags/$latest" +rm -rf .git +nix --extra-experimental-features nix-command hash path .