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
|
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
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
JAVA_TOOL_OPTIONS="-XX:+UseG1GC -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:+UseStringDeduplication ${args}" bisq-desktop-wrapped "$@"
|
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";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "1.9.12";
|
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";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "0zzrl7dmd3m7pymwvl68gnjspbpzf1w17bcwr0ipgsszmr35k9rs";
|
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
|
|
|
|
];
|
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
|
2021-08-22 07:53:02 +00:00
|
|
|
zip -r opt/bisq/lib/app/desktop-${version}-all.jar native
|
2023-07-15 17:15:38 +00:00
|
|
|
strip-nondeterminism opt/bisq/lib/app/desktop-${version}-all.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
|
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
mkdir -p $out/lib $out/bin
|
|
|
|
cp opt/bisq/lib/app/desktop-${version}-all.jar $out/lib
|
|
|
|
|
|
|
|
makeWrapper ${openjdk11}/bin/java $out/bin/bisq-desktop-wrapped \
|
|
|
|
--add-flags "-jar $out/lib/desktop-${version}-all.jar bisq.desktop.app.BisqAppMain"
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
makeWrapper ${bisq-launcher ""} $out/bin/bisq-desktop \
|
|
|
|
--prefix PATH : $out/bin
|
|
|
|
|
|
|
|
makeWrapper ${bisq-launcher "-Dglass.gtk.uiScale=2.0"} $out/bin/bisq-desktop-hidpi \
|
2021-07-03 03:11:41 +00:00
|
|
|
--prefix PATH : $out/bin
|
|
|
|
|
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
}
|