From b8b02a8606c6438b03ea861392f49b4d9940fd30 Mon Sep 17 00:00:00 2001 From: Emmanuel Rosa Date: Sun, 9 Jun 2024 13:29:32 -0400 Subject: [PATCH] bisq2: init @ 2.1.0 --- pkgs/by-name/bi/bisq/package.nix | 131 +++++++++++++++++++++++++++++++ pkgs/by-name/bi/bisq/pubkey.asc | 52 ++++++++++++ pkgs/top-level/all-packages.nix | 4 + 3 files changed, 187 insertions(+) create mode 100644 pkgs/by-name/bi/bisq/package.nix create mode 100644 pkgs/by-name/bi/bisq/pubkey.asc diff --git a/pkgs/by-name/bi/bisq/package.nix b/pkgs/by-name/bi/bisq/package.nix new file mode 100644 index 0000000000000..f0c27093c8508 --- /dev/null +++ b/pkgs/by-name/bi/bisq/package.nix @@ -0,0 +1,131 @@ +{ stdenvNoCC, lib, makeWrapper, fetchurl, makeDesktopItem, copyDesktopItems +, imagemagick, openjdk, dpkg, writeScript, bash, tor, zip, gnupg }: + +let + bisq-launcher = args: + writeScript "bisq-launcher" '' + #! ${bash}/bin/bash + + # This is just a comment to convince Nix that Tor is a + # runtime dependency; The Tor binary is in a *.jar file, + # whereas Nix only scans for hashes in uncompressed text. + # ${bisq-tor} + + rm -fR $HOME/.local/share/Bisq2/tor + + exec "${openjdk}/bin/java" -Djpackage.app-version=@version@ -classpath @out@/lib/app/desktop-app-launcher.jar:@out@/lib/app/* ${args} bisq.desktop_app_launcher.DesktopAppLauncher "$@" + ''; + + bisq-tor = writeScript "bisq-tor" '' + #! ${bash}/bin/bash + + exec ${tor}/bin/tor "$@" + ''; + + # Alejandro Garcia's public key was obtained from + # https://bisq.network/pubkey/E222AA02.asc + publicKey = ./pubkey.asc; +in stdenvNoCC.mkDerivation rec { + pname = "bisq2"; + version = "2.1.0"; + + src = fetchurl { + url = + "https://github.com/bisq-network/bisq2/releases/download/v${version}/Bisq-${version}.deb"; + sha256 = "sha256-nvJy7V0Jh0gWpDtj9tq4yjd/npOcy+wTo8YKAOJUOJs="; + + # Verify the upstream Debian package prior to extraction. + # See https://bisq.wiki/Downloading_and_installing#Verify_installer_file + # This ensures that a successful build of this Nix package requires the Debian + # package to pass verification. + nativeBuildInputs = [ gnupg ]; + downloadToTemp = true; + + postFetch = '' + pushd $(mktemp -d) + export GNUPGHOME=./gnupg + mkdir -m 700 -p $GNUPGHOME + ln -s $downloadedFile ./Bisq-${version}.deb + ln -s ${signature} ./signature.asc + gpg --import ${publicKey} + gpg --batch --verify signature.asc Bisq-${version}.deb + popd + mv $downloadedFile $out + ''; + }; + + signature = fetchurl { + url = + "https://github.com/bisq-network/bisq2/releases/download/v${version}/Bisq-${version}.deb.asc"; + sha256 = "sha256-D8hLTTXTnoC75sePBZu2SO4I6DldwWNaxJCSDH+OElE="; + }; + + nativeBuildInputs = + [ copyDesktopItems dpkg imagemagick makeWrapper zip gnupg ]; + + desktopItems = [ + (makeDesktopItem { + name = "Bisq2"; + exec = "bisq2"; + icon = "bisq2"; + desktopName = "Bisq ${version}"; + genericName = "Decentralized bitcoin exchange"; + categories = [ "Network" "P2P" ]; + }) + + (makeDesktopItem { + name = "Bisq2-hidpi"; + exec = "bisq2-hidpi"; + icon = "bisq2"; + desktopName = "Bisq ${version} (HiDPI)"; + genericName = "Decentralized bitcoin exchange"; + categories = [ "Network" "P2P" ]; + }) + ]; + + unpackPhase = '' + dpkg -x $src . + ''; + + buildPhase = '' + # Replace the Tor binary embedded in tor.jar (which is in the zip archive tor.zip) + # with the Tor binary from Nixpkgs. + + cp ${bisq-tor} ./tor + zip tor.zip ./tor + zip opt/bisq2/lib/app/tor.jar tor.zip + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib $out/bin + cp -r opt/bisq2/lib/app $out/lib + + install -D -m 777 ${bisq-launcher ""} $out/bin/bisq2 + substituteAllInPlace $out/bin/bisq2 + + install -D -m 777 ${ + bisq-launcher "-Dglass.gtk.uiScale=2.0" + } $out/bin/bisq2-hidpi + substituteAllInPlace $out/bin/bisq2-hidpi + + for n in 16 24 32 48 64 96 128 256; do + size=$n"x"$n + magick convert opt/bisq2/lib/Bisq2.png -resize $size bisq2.png + install -Dm644 -t $out/share/icons/hicolor/$size/apps bisq2.png + done; + + runHook postInstall + ''; + + meta = with lib; { + description = "A decentralized bitcoin exchange network"; + homepage = "https://bisq.network"; + mainProgram = "bisq2"; + sourceProvenance = with sourceTypes; [ binaryBytecode nativeBinaryCode ]; + license = licenses.mit; + maintainers = with maintainers; [ emmanuelrosa ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/bi/bisq/pubkey.asc b/pkgs/by-name/bi/bisq/pubkey.asc new file mode 100644 index 0000000000000..1a70fe9265ca9 --- /dev/null +++ b/pkgs/by-name/bi/bisq/pubkey.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGM0b8UBEACe6FDEer8HPl99AVTHE9t+k/t1L9ch9W696IwrdiUr5MW9vwMU +gMV50wTuS5bCDMh/n0PodLzlqSQUUc+U6smdX7rPNwQ1eJevHpmQHg/QJJDYRyw3 +XC4GWQcvhY78sCLByFM8xmXJQJCYaFsoBxHHDbEhY8/1JfxFkw2MSSvRE73aElwE +2z30CDlJG+fYbVWkn5jKfMmDT/SVHwbwAPgHxIy6vvL2TGOa9O3eqNuKylPGTxVO +5VdWJDsk/Wok3aZ5uKaHgjdO7pgrKzYy0MC/mo47nQECcCgqgpQHRCfILYlLvOvM +VlIu1TCOfj0MkPj5na/JfpcVSWFkDUWdS9NSb8XNZai/kZ6ZSDiZ5hoIcLW2xcmw +DXy75U9g1glFm5Girl7dPtLkFhUSj0VtCfqJccOFkdZZGkaHckDJVEe8igD+QoUz +bAyujKj1qBJGdfLCuF0eR9Ta1Hj6SG067FhB1tl4/j8ARHWIrCQquYJUUll7iRMd +Tc/cXjmNlzMr7jXERwzg+i2591eA6SC4iAoGS3k8ppaJhuN+fzw4rsrC2MM+fzt8 +vWdCVL7yHHDOfeAb7IwKAFDltQonBYFcq+PM2mVrWR3k7yM3BCBxk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fACPdOCfy0uprzGdVsF +0Mj88kUywckhXMZNvm70eA040vskrSKm0ndySPF40oJNlk28Y1KD3llM8ZQ/9KYZ +E7/h69lX6v+EuV1sDVilvCxj4nyMRNrZQ2c2MpGK18Asxl3aW+OdG03Wek+0Gk+j +RU3NOq3K1YG/B0O1k2wUV1gIjc+M0s/v2JIVDMrELm/4Dw4Q1W83f9kr2ep9OtnI +wZqbZnD2LMIObxM3CGeKAsX7JZONhXdKtrhAXin1Pq03MzXgQmNsGv2cIyTSMbvd +E75tU69fX3jkrGUnqLQIJ/yI3fXUCXnd +=ektd +-----END PGP PUBLIC KEY BLOCK----- diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cc9e1a55b1ab4..f876d46d3b6a4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3452,6 +3452,10 @@ with pkgs; openjdk11 = openjdk11.override { enableJavaFX = true; }; }; + bisq_2 = callPackage ../by-name/bi/bisq/package.nix { + openjdk = openjdk.override { enableJavaFX = true; }; + }; + bic = callPackage ../development/interpreters/bic { }; biscuit-cli = callPackage ../tools/security/biscuit-cli { };