Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { stdenv, jdk11, fetchFromGitHub, gradle, libXtst, libX11, cairo, pango, freetype, gtk3, gtk2, perl, protobuf3_5, writeText }:
- let
- version = "v0.8.0";
- name = "bisq-${version}";
- src = fetchFromGitHub {
- owner = "bisq-network";
- repo = "bisq";
- rev = version;
- sha256 = "0kq0f8wxjvvjfn1layvfhc0zf899k7qsph8m0x7wzm31gk1npbfz";
- };
- postPatch = ''
- # disable grade native code
- # substituteInPlace build.gradle \
- # --replace 'artifact = "com.google.protobuf:protoc:$protobufVersion"' "path = '${protobuf3_5}/bin/protoc'"
- '';
- # fake build to pre-download deps into fixed-output derivation
- deps = stdenv.mkDerivation {
- name = "${name}-deps";
- inherit src postPatch;
- nativeBuildInputs = [ perl (gradle.override { jdk = jdk11; }) ];
- buildPhase = ''
- export GRADLE_USER_HOME=$(mktemp -d)
- gradle -version
- gradle --no-daemon build
- '';
- # Mavenize dependency paths
- # e.g. org.codehaus.groovy/groovy/2.4.0/{hash}/groovy-2.4.0.jar -> org/codehaus/groovy/groovy/2.4.0/groovy-2.4.0.jar
- installPhase = ''
- find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
- | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
- | sh
- '';
- outputHashAlgo = "sha256";
- outputHashMode = "recursive";
- outputHash = "10qfw4gqw4gbjwxg7ywf1hd4dv8kg0v75crb2f1p72ss0lra0iw2";
- };
- # Point to our local deps repo
- gradleInit = writeText "init.gradle" ''
- logger.lifecycle 'Replacing Maven repositories with ${deps}...'
- gradle.projectsLoaded {
- rootProject.allprojects {
- buildscript {
- repositories {
- clear()
- maven { url '${deps}' }
- }
- }
- repositories {
- clear()
- maven { url '${deps}' }
- }
- }
- }
- '';
- in stdenv.mkDerivation {
- inherit name src postPatch;
- buildInputs = [ gradle libXtst cairo pango freetype libX11 gtk3 gtk2];
- buildPhase = ''
- export GRADLE_USER_HOME=$(mktemp -d)
- gradle --offline --no-daemon --init-script ${gradleInit} build
- '';
- installPhase = ''
- '';
- meta = with stdenv.lib; {
- homepage = https://bisq.network/;
- description = "Bisq is an open-source desktop application that allows you to buy and sell bitcoins in exchange for national currencies, or alternative crypto currencies.";
- license = licenses.gpl2;
- maintainers = with maintainers; [ gavin ];
- platforms = [ "x86_64-darwin" "x86_64-linux" "i686-linux" ];
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement