From 1bb801ad7bf7c2b09d2fe2ed888f9956e0569f57 Mon Sep 17 00:00:00 2001 From: nixbitcoin Date: Tue, 7 Jul 2020 10:30:08 +0000 Subject: [PATCH] lightning-loop: add pkg --- pkgs/default.nix | 1 + pkgs/lightning-loop/default.nix | 23 +++++++++++++++++++++++ pkgs/lightning-loop/get-sha256.sh | 27 +++++++++++++++++++++++++++ pkgs/netns-exec/src/main.c | 1 + pkgs/pinned.nix | 4 +++- 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 pkgs/lightning-loop/default.nix create mode 100755 pkgs/lightning-loop/get-sha256.sh diff --git a/pkgs/default.nix b/pkgs/default.nix index f710f04..7986379 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -11,6 +11,7 @@ generate-secrets = pkgs.callPackage ./generate-secrets { }; nixops19_09 = pkgs.callPackage ./nixops { }; netns-exec = pkgs.callPackage ./netns-exec { }; + lightning-loop = pkgs.callPackage ./lightning-loop { }; pinned = import ./pinned.nix; } diff --git a/pkgs/lightning-loop/default.nix b/pkgs/lightning-loop/default.nix new file mode 100644 index 0000000..f1b7e1a --- /dev/null +++ b/pkgs/lightning-loop/default.nix @@ -0,0 +1,23 @@ +{ pkgs, buildGoModule, fetchurl, lib }: + +buildGoModule rec { + pname = "lightning-loop"; + version = "0.7.0-beta"; + + src = fetchurl { + url = "https://github.com/lightninglabs/loop/archive/v${version}.tar.gz"; + # Use ./get-sha256.sh to fetch latest (verified) sha256 + sha256 = "fbb5ae6dd55002a632a924e41a0bb2ce886eb9e834668be35b312b14e8b68233"; + }; + + subPackages = [ "cmd/loop" "cmd/loopd" ]; + + vendorSha256 = "1g0l09zcic5nnrsdyap40dj3zl59gbb2k8iirhph3257ysa52mhr"; + + meta = with lib; { + description = " Lightning Loop: A Non-Custodial Off/On Chain Bridge"; + homepage = "https://github.com/lightninglabs/loop"; + license = lib.licenses.mit; + maintainers = with maintainers; [ nixbitcoin ]; + }; +} diff --git a/pkgs/lightning-loop/get-sha256.sh b/pkgs/lightning-loop/get-sha256.sh new file mode 100755 index 0000000..cfadcab --- /dev/null +++ b/pkgs/lightning-loop/get-sha256.sh @@ -0,0 +1,27 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p git gnupg +set -euo pipefail + +TMPDIR="$(mktemp -d -p /tmp)" +trap "rm -rf $TMPDIR" EXIT +cd $TMPDIR + +echo "Fetching latest release" +git clone https://github.com/lightninglabs/loop 2> /dev/null +cd loop +latest=$(git describe --tags `git rev-list --tags --max-count=1`) +echo "Latest release is ${latest}" + +# GPG verification +export GNUPGHOME=$TMPDIR +echo "Fetching Joost Jager's Key" +gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys D146D0F68939436268FA9A130E26BB61B76C4D3A 2> /dev/null +echo "Fetching Alex Bosworth's Key" +gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E 2> /dev/null + +echo "Verifying latest release" +git verify-tag ${latest} + +echo "tag: ${latest}" +# The prefix option is necessary because GitHub prefixes the archive contents in this format +echo "sha256: $(git archive --format tar.gz --prefix=loop-${latest//v}/ ${latest} | sha256sum | cut -d\ -f1)" diff --git a/pkgs/netns-exec/src/main.c b/pkgs/netns-exec/src/main.c index aec799c..3271fc0 100644 --- a/pkgs/netns-exec/src/main.c +++ b/pkgs/netns-exec/src/main.c @@ -14,6 +14,7 @@ static char *available_netns[] = { "nb-lnd", + "nb-lightning-loop", "nb-bitcoind", "nb-liquidd" }; diff --git a/pkgs/pinned.nix b/pkgs/pinned.nix index 6fe06e2..212c2fd 100644 --- a/pkgs/pinned.nix +++ b/pkgs/pinned.nix @@ -11,7 +11,9 @@ in bitcoind clightning lnd; - inherit (nixBitcoinPkgsUnstable) electrs; + inherit (nixBitcoinPkgsUnstable) + electrs + lightning-loop; stable = nixBitcoinPkgsStable; unstable = nixBitcoinPkgsUnstable;