Skip to content

Instantly share code, notes, and snippets.

@ziqiq
Last active October 9, 2024 08:22
Show Gist options
  • Save ziqiq/9498f030e503d59a10fdc9afc01a2a6a to your computer and use it in GitHub Desktop.
Save ziqiq/9498f030e503d59a10fdc9afc01a2a6a to your computer and use it in GitHub Desktop.
Sparrow wallet flatpak manifest

Installation for End User

  1. Install flatpak builder
flatpak install --user org.flatpak.Builder
  1. Build and install the Sparrow manifest
flatpak run org.flatpak.Builder --user --install builddir com.sparrowwallet.Sparrow.yml

This will create two directories which could be removed later:

  • .flatpak-builder dependency cache
  • builddir the files in flatpak app image

Note:

  • The Sparrow home directory is ~/.var/app/com.sparrowwallet.Sparrow/.sparrow. You might want to copy the existing data file from ~/.sparrow into it (or create a symbolic link).
id: com.sparrowwallet.Sparrow
branch: 1.9.1
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: Sparrow
modules:
- name: Sparrow
buildsystem: simple
build-commands:
- install -Dm 644 lib/Sparrow.png share/icons/hicolor/256x256/apps/com.sparrowwallet.Sparrow.png
- cp -rT . /app
sources:
- type: archive
only-arches: ["x86_64"]
url: https://github.com/sparrowwallet/sparrow/releases/download/1.9.1/sparrow-1.9.1-x86_64.tar.gz
sha256: 6f53888b348c4ceb4b337fd11620493d26e48ff0b4774b39820714c2309d041a
- type: archive
only-arches: ["aarch64"]
url: https://github.com/sparrowwallet/sparrow/releases/download/1.9.1/sparrow-1.9.1-aarch64.tar.gz
sha256: a85963df358008fc6d5d5d75318ddff6b0904fa92d82028c96f1fedd6593fc02
- type: inline
dest: share/applications/
dest-filename: com.sparrowwallet.Sparrow.desktop
contents: |
[Desktop Entry]
Name=Sparrow
Exec=Sparrow
Type=Application
Icon=com.sparrowwallet.Sparrow
Categories=Network;Finance;Java;
- name: libusb
buildsystem: autotools
config-opts:
- --disable-static
sources:
- type: archive
url: https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.tar.bz2
sha256: ffaa41d741a8a3bee244ac8e54a72ea05bf2879663c098c82fc5757853441575
finish-args:
- --socket=x11
- --socket=pcsc
- --device=dri
# - --device=usb
- --device=all
- --share=network
- --persist=.sparrow
@DeepDoge
Copy link

DeepDoge commented Sep 16, 2024

When I open the desktop file from the launcher nothing happens.

On the terminal I get this error:

❯ flatpak run com.sparrowwallet.Sparrow
No display detected. Use Sparrow Server on a headless (no display) system.

@ziqiq
Copy link
Author

ziqiq commented Sep 16, 2024

When I open the desktop file from the launcher nothing happens.

On the terminal I get this error:

❯ flatpak run com.sparrowwallet.Sparrow
No display detected. Use Sparrow Server on a headless (no display) system.

Look like a display server connection issue. Maybe add a --socket=x11 in finish-args?

@DeepDoge
Copy link

DeepDoge commented Sep 16, 2024

im already using wayland
but i was able to fix the issue with this:

finish-args:
  - --socket=x11
  - --socket=wayland
  - --share=network
  - --device=dri
  - --env=DISPLAY=:0
  - --persist=.sparrow

it works now, thank you

@ziqiq
Copy link
Author

ziqiq commented Sep 16, 2024

@DeepDoge Probably javafx doesn't work with wayland? 🤔 I'm using x11 not wayland, so it might fallback to x11 on the host. Do you mind confirming if it works without --socket=wayland and --env=DISPLAY=:0?

@DeepDoge
Copy link

DeepDoge commented Sep 16, 2024

It works without socket=wayland and env=DISPLAY=:0.

It requires:

  • socket=x11
  • device=dri

Without device=dri I get this:

❯ flatpak run com.sparrowwallet.Sparrow
MESA: error: Failed to query drm device.
glx: failed to create dri3 screen
failed to load driver: iris

So this works:

finish-args:
  - --socket=x11
  - --share=network
  - --device=dri
  - --persist=.sparrow

Also I had an issue with Scan for Connected Devices, which I fixed it by:

  • Adding libusb as module.
  • Adding device=all to finish-args.
modules:
  - name: libusb
    buildsystem: autotools
    config-opts:
      - --disable-static
    sources:
      - type: archive
        url: https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.tar.bz2
        sha256: ffaa41d741a8a3bee244ac8e54a72ea05bf2879663c098c82fc5757853441575
finish-args:
  - --device=all

@ziqiq
Copy link
Author

ziqiq commented Sep 16, 2024

@DeepDoge Thanks for sharing your details. I also tried a couple of display server combination, it needs either --socket=x11 or --socket=wayland --socket=fallback-x11, so I think JavaFX in the runtime doesn't use wayland anyways. For --device=dri, my guess is JavaFX might use openGL for rendering with some hardware not present on my host.

I'm not a Java expert 😅 but hopefully my updated manifest could work on most environment.

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