Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haveno: init #311314

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

haveno: init #311314

wants to merge 4 commits into from

Conversation

Kreyren
Copy link
Contributor

@Kreyren Kreyren commented May 13, 2024

Description of changes

Best effort to package haveno in NixOS

Status: Implementation blocked by haveno-dex/haveno#1206

Fixes: #293842

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.


* What went wrong:
Execution failed for task ':proto:generateProto'.
> java.io.IOException: Cannot run program "/build/tmp.YollhrLx8O/caches/modules-2/files-2.1/com.google.protobuf/protoc/3.19.1/d231c807be82ffc29b02525c8c2691772eb945bc/protoc-3.19.1-linux-x86_64.exe": error=2, No such file or directory
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HELP_WANTED: Spent 7 hours on this and I have no idea how to fix this.. It seems to only happen on NixOS

RFC @obfusk @linsui You seem to have been dealing with problems alike while packaging apksigner, your input to this would be very appreciated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we? You should first check if the file is there. If it's there, then the problem is that it tries to run a binary on NixOS. You should patch something so that the protoc in nixpkgs is used instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emmanuelrosa
Copy link
Contributor

Having been down this road before, I'll say this:

  • Building Java applications with Nix, especially with Gradle, is in my opinion not worth one's time. Perhaps there'll be better tooling in the future, but at this time it's not a good experience.
  • Haveno is not on Mainnet yet. Perhaps that's why there are no compiled releases even though the Github CI to build it is in place. In short, it's not ready for users.
  • Once Haveno is on mainnet, it's quite likely upstream will provide compiled releases. You can package that instead. It's not easy, but it's way simpler than building from source.

@chayleaf
Copy link
Contributor

#272380 got merged, so you can give this a second shot now! See https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/gradle.section.md

@Kreyren
Copy link
Contributor Author

Kreyren commented Jul 16, 2024

#272380 got merged, so you can give this a second shot now! See master/doc/languages-frameworks/gradle.section.md -- @chayleaf (#311314 (comment))

Thanks for letting me know, i was monitoring that merge request to see where it's going to figure out how to handle this package as packaging a pre-built binary for this kind of software felt like a huge dis-service to the Monero Community, i try to make a time frame in my schedule for this as soon as i can.

Optionally if you have more time than me atm (projected to be actionable in ~2 weeks), then feel free to take over this merge request.

@Kreyren
Copy link
Contributor Author

Kreyren commented Aug 9, 2024

CC @chayleaf: I am trying your gradle building and following the provided instructions above i figured out:

NiXium-devshell> vendor/nixpkgs $ nix-build -A haveno.mitmCache.updateScript
...
/nix/store/2q9by164abgyffplp44h3sccfhscs2y6-fetch-deps.sh
NiXium-devshell> vendor/nixpkgs $ /nix/store/2q9by164abgyffplp44h3sccfhscs2y6-fetch-deps.sh
/tmp/nix-shell-2-1/rc: line 1: rm: command not found
Running phase: unpackPhase
unpacking source archive /nix/store/skdvr05c7j388haxwn98q0yi9m4d7l6f-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
Owner: CN=example.org, OU=a, O=a, L=a, ST=a, C=AL
Issuer: CN=example.org, OU=a, O=a, L=a, ST=a, C=AL
Serial number: 1e02cfa620d00428950f7b4518aabfe449d5ca05
Valid from: Fri Aug 09 21:18:32 UTC 2024 until: Sat Aug 10 21:18:32 UTC 2024
Certificate fingerprints:
	 SHA1: 34:51:FF:8C:D5:1A:07:6C:E2:4A:11:97:A3:90:25:3B:F7:CC:C0:E8
	 SHA256: 84:49:0B:CA:FF:1B:65:CA:A8:7B:D0:E3:08:8C:FC:29:8B:78:E6:82:AB:52:5B:34:F2:B7:B4:EB:5F:C0:2B:50
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 29 E9 4D A5 81 5B 5D BD   FD 30 52 CC 17 3B C5 A0  ).M..[]..0R..;..
0010: 5F 29 AA 56                                        _).V
]
]

#2: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen: no limit
]

#3: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 29 E9 4D A5 81 5B 5D BD   FD 30 52 CC 17 3B C5 A0  ).M..[]..0R..;..
0010: 5F 29 AA 56                                        _).V
]
]

Trust this certificate? [no]:  Certificate was added to keystore
no configure script, doing nothing
Running phase: gradleUpdateScript

Welcome to Gradle 8.8!

Here are the highlights of this release:
 - Running Gradle on Java 22
 - Configurable Gradle daemon JVM
 - Improved IDE performance for large projects

For more details see https://docs.gradle.org/8.8/release-notes.html

To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.8/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'haveno'.
> Multiple build operations failed.
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
      ...and 15 more failures.
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).
   > Could not open cache sha256-checksums.bin (/tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/checksums/sha256-checksums.bin).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 29s

FAILURE: Build failed with an exception.

* What went wrong:
Failed to notify root build lifecycle listener.
> Could not update /tmp/tmp.o8CxH2TkIE/caches/8.8/file-changes/last-build.bin
> Could not update /tmp/tmp.7ICYCkh0Ck/source/.gradle/8.8/fileChanges/last-build.bin

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 29s

FAILURE: Build failed with an exception.

* What went wrong:
Could not receive a message from the daemon.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

These seems to be a problem somewhere in the mitmCache

EDIT: Actually it might be related to my hardening.. investigating..

Running into:

/tmp/nix-shell-2-14/rc: line 1: rm: command not found
Running phase: unpackPhase
unpacking source archive /nix/store/5ns5qwa08xfjmxlan1f9mmcnx5z0zvkq-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
Owner: CN=example.org, OU=a, O=a, L=a, ST=a, C=AL
Issuer: CN=example.org, OU=a, O=a, L=a, ST=a, C=AL
Serial number: 5f70ac8e404f7f6f9e92072bfd214d7c58f60fe3
Valid from: Fri Aug 09 22:15:59 UTC 2024 until: Sat Aug 10 22:15:59 UTC 2024
Certificate fingerprints:
         SHA1: 0C:AA:05:49:B6:54:E9:8C:4F:CD:26:B7:12:5B:CD:CA:FE:AC:28:BA
         SHA256: B5:FE:A4:8C:1A:8C:24:8A:40:A5:90:51:06:38:CA:34:4C:58:51:89:97:E2:DF:97:8E:A3:14:2E:90:25:34:8C
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions: 

#1: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: DB 8F 1A 64 3E DB 74 B3   AB E8 50 73 23 93 8C E4  ...d>.t...Ps#...
0010: 6E B5 55 DE                                        n.U.
]
]

#2: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen: no limit
]

#3: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: DB 8F 1A 64 3E DB 74 B3   AB E8 50 73 23 93 8C E4  ...d>.t...Ps#...
0010: 6E B5 55 DE                                        n.U.
]
]

Trust this certificate? [no]:  Certificate was added to keystore
no configure script, doing nothing
Running phase: gradleUpdateScript

Welcome to Gradle 8.8!

Here are the highlights of this release:
 - Running Gradle on Java 22
 - Configurable Gradle daemon JVM
 - Improved IDE performance for large projects

For more details see https://docs.gradle.org/8.8/release-notes.html

To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.8/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build 
> Task :nixDownloadDeps
> Task :common:nixDownloadDeps FAILED
> Task :assets:nixDownloadDeps
> Task :cli:nixDownloadDeps
> Task :apitest:nixDownloadDeps FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Initialization script '/nix/store/wdw15x3256w3gv7jkjmaz211q3344xvc-init-deps.gradle' line: 5

* What went wrong:
Execution failed for task ':common:nixDownloadDeps'.
> Could not resolve all files for configuration ':common:aggregateCodeCoverageReportResults'.
   > Could not resolve com.github.JesusMcCloud:jtorctl:9b5ba2036b.
     Required by:
         project :common
      > Could not resolve com.github.JesusMcCloud:jtorctl:9b5ba2036b.
         > Could not get resource 'https://jitpack.io/com/github/JesusMcCloud/jtorctl/9b5ba2036b/jtorctl-9b5ba2036b.pom'.
            > Could not GET 'https://jitpack.io/com/github/JesusMcCloud/jtorctl/9b5ba2036b/jtorctl-9b5ba2036b.pom'. Received status code 401 from server: Unauthorized

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* Where:
Initialization script '/nix/store/wdw15x3256w3gv7jkjmaz211q3344xvc-init-deps.gradle' line: 5

* What went wrong:
Execution failed for task ':apitest:nixDownloadDeps'.
> Could not resolve all files for configuration ':apitest:aggregateCodeCoverageReportResults'.
   > Could not resolve com.github.JesusMcCloud:jtorctl:9b5ba2036b.
     Required by:
         project :apitest > project :common
      > Could not resolve com.github.JesusMcCloud:jtorctl:9b5ba2036b.
         > Could not get resource 'https://jitpack.io/com/github/JesusMcCloud/jtorctl/9b5ba2036b/jtorctl-9b5ba2036b.pom'.
            > Could not GET 'https://jitpack.io/com/github/JesusMcCloud/jtorctl/9b5ba2036b/jtorctl-9b5ba2036b.pom'. Received status code 401 from server: Unauthorized

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 42s
5 actionable tasks: 5 executed

Which doesn't seem to happen when trying other packages

Diagnosed as upstream issue: haveno-dex/haveno#1206

@Kreyren
Copy link
Contributor Author

Kreyren commented Aug 12, 2024

Dependency Issue reportedly solved in haveno-dex/haveno#1208 as reported in haveno-dex/haveno#1206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: Haveno
4 participants