2021-07-03 03:11:41 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, makeWrapper
|
|
|
|
, fetchurl
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
, imagemagick
|
|
|
|
, openjdk11
|
|
|
|
, dpkg
|
|
|
|
, writeScript
|
|
|
|
, bash
|
2023-07-15 17:15:38 +00:00
|
|
|
, strip-nondeterminism
|
2021-07-03 03:11:41 +00:00
|
|
|
, tor
|
2021-08-22 07:53:02 +00:00
|
|
|
, zip
|
|
|
|
, xz
|
2024-01-02 11:29:13 +00:00
|
|
|
, findutils
|
2021-07-03 03:11:41 +00:00
|
|
|
}:
|
2021-08-10 14:31:46 +00:00
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
let
|
2023-07-15 17:15:38 +00:00
|
|
|
bisq-launcher = args: writeScript "bisq-launcher" ''
|
2021-07-03 03:11:41 +00:00
|
|
|
#! ${bash}/bin/bash
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
# 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}
|
2021-07-03 03:11:41 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
classpath=@out@/lib/desktop.jar:@out@/lib/*
|
|
|
|
|
|
|
|
exec "${openjdk11}/bin/java" -Djpackage.app-version=@version@ -XX:MaxRAM=8g -Xss1280k -XX:+UseG1GC -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:+UseStringDeduplication -Djava.net.preferIPv4Stack=true -classpath $classpath ${args} bisq.desktop.app.BisqAppMain "$@"
|
2021-08-22 07:53:02 +00:00
|
|
|
'';
|
2021-07-03 03:11:41 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
bisq-tor = writeScript "bisq-tor" ''
|
|
|
|
#! ${bash}/bin/bash
|
2021-07-03 03:11:41 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
exec ${tor}/bin/tor "$@"
|
2021-07-03 03:11:41 +00:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bisq-desktop";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "1.9.14";
|
2021-07-03 03:11:41 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/bisq-network/bisq/releases/download/v${version}/Bisq-64bit-${version}.deb";
|
2024-01-02 11:29:13 +00:00
|
|
|
sha256 = "0xbq94qbp59523xjp80bly38aisfwkfi0y9hmyhf8xlw084b82kz";
|
2021-07-03 03:11:41 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
copyDesktopItems
|
|
|
|
dpkg
|
|
|
|
imagemagick
|
|
|
|
makeWrapper
|
|
|
|
strip-nondeterminism
|
|
|
|
xz
|
|
|
|
zip
|
2024-01-02 11:29:13 +00:00
|
|
|
findutils
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
2021-08-10 14:31:46 +00:00
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "Bisq";
|
|
|
|
exec = "bisq-desktop";
|
|
|
|
icon = "bisq";
|
2021-08-22 07:53:02 +00:00
|
|
|
desktopName = "Bisq ${version}";
|
2021-07-03 03:11:41 +00:00
|
|
|
genericName = "Decentralized bitcoin exchange";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Network" "P2P" ];
|
2021-07-03 03:11:41 +00:00
|
|
|
})
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "Bisq-hidpi";
|
|
|
|
exec = "bisq-desktop-hidpi";
|
|
|
|
icon = "bisq";
|
|
|
|
desktopName = "Bisq ${version} (HiDPI)";
|
|
|
|
genericName = "Decentralized bitcoin exchange";
|
|
|
|
categories = [ "Network" "P2P" ];
|
|
|
|
})
|
2021-07-03 03:11:41 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
dpkg -x $src .
|
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
buildPhase = ''
|
|
|
|
# Replace the embedded Tor binary (which is in a Tar archive)
|
|
|
|
# with one from Nixpkgs.
|
|
|
|
|
|
|
|
mkdir -p native/linux/x64/
|
|
|
|
cp ${bisq-tor} ./tor
|
2023-07-15 17:15:38 +00:00
|
|
|
tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" -cJf native/linux/x64/tor.tar.xz tor
|
2024-01-02 11:29:13 +00:00
|
|
|
tor_jar_file=$(find ./opt/bisq/lib/app -name "tor-binary-linux64-*.jar")
|
|
|
|
zip -r $tor_jar_file native
|
|
|
|
strip-nondeterminism ./opt/bisq/lib/app/*.jar
|
2021-08-22 07:53:02 +00:00
|
|
|
'';
|
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
installPhase = ''
|
2021-08-10 14:31:46 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
mkdir -p $out $out/bin
|
|
|
|
cp -r opt/bisq/lib/app $out/lib
|
2021-07-03 03:11:41 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
install -D -m 777 ${bisq-launcher ""} $out/bin/bisq-desktop
|
|
|
|
substituteAllInPlace $out/bin/bisq-desktop
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
install -D -m 777 ${bisq-launcher "-Dglass.gtk.uiScale=2.0"} $out/bin/bisq-desktop-hidpi
|
|
|
|
substituteAllInPlace $out/bin/bisq-desktop-hidpi
|
2021-07-03 03:11:41 +00:00
|
|
|
|
|
|
|
for n in 16 24 32 48 64 96 128 256; do
|
|
|
|
size=$n"x"$n
|
2021-08-22 07:53:02 +00:00
|
|
|
convert opt/bisq/lib/Bisq.png -resize $size bisq.png
|
2021-07-03 03:11:41 +00:00
|
|
|
install -Dm644 -t $out/share/icons/hicolor/$size/apps bisq.png
|
|
|
|
done;
|
2021-08-10 14:31:46 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2021-07-03 03:11:41 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A decentralized bitcoin exchange network";
|
|
|
|
homepage = "https://bisq.network";
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2021-07-03 03:11:41 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ juaningan emmanuelrosa ];
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|