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

Flatpak support #91

Open
cfergeau opened this issue Nov 15, 2024 · 3 comments
Open

Flatpak support #91

cfergeau opened this issue Nov 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@cfergeau
Copy link

I did some work to create a flatpak from the .deb package. I followed these instructions https://v2.tauri.app/distribute/flatpak/
The .yml file below generates a flatpak I can install and run, but it get permission denials when trying to access USB devices. I haven't been able to investigate/fix that yet.

$ cat dev.zmk.studio.yml 
id: dev.zmk.Studio

runtime: org.gnome.Platform
runtime-version: '46'
sdk: org.gnome.Sdk

command: app
finish-args:
  - --socket=wayland # Permission needed to show the window
  - --socket=fallback-x11 # Permission needed to show the window
  - --device=all # need access to serial devices (keyboard)
  - --allow=bluetooth
  - --share=ipc

modules:
  - name: binary
    buildsystem: simple
    sources:
      - type: file
        url: https://github.com/zmkfirmware/zmk-studio/releases/download/v0.2.3/zmk-studio_0.2.3_amd64.deb
        sha256: f96f69fdca822359e52b804af8523cc2c9674ec74ee0e2d2a9b45ea9bfc62e05
        only-arches: [x86_64] #This source is only used on x86_64 Computers
    build-commands:
      - ar -x *.deb
      - tar -xf data.tar.gz
      - 'install -Dm755 usr/bin/app /app/bin/app'
      - install -Dm644 usr/share/applications/app.desktop /app/share/applications/dev.zmk.Studio.desktop
      - sed -i 's/Icon=app/Icon=dev.zmk.Studio/' /app/share/applications/dev.zmk.Studio.desktop
      - install -Dm644 usr/share/icons/hicolor/128x128/apps/app.png /app/share/icons/hicolor/128x128/apps/dev.zmk.Studio.png
      - install -Dm644 usr/share/icons/hicolor/32x32/apps/app.png /app/share/icons/hicolor/32x32/apps/dev.zmk.Studio.png
      - install -Dm644 usr/share/icons/hicolor/256x256@2/apps/app.png /app/share/icons/hicolor/256x256@2/apps/dev.zmk.Studio.png

$ flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo builddir dev.zmk.studio.yml
[...]

$ flatpak build-bundle repo zmkstudio.flatpak dev.zmk.Studio --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
[...]

$ flatpak install ./zmkstudio.flatpak
[...]

$ flatpak run dev.zmk.Studio
@cfergeau cfergeau added the bug Something isn't working label Nov 15, 2024
@petejohanson
Copy link
Collaborator

Thanks for creating the issue. The way Tauri suggests doing this may sorta work, but is really, AFAICT, not-ideal since it's not actually building the flatpack. This would limit the flatpak to x86_64 only. and also probably disqualify this from actually getting submitted to flathub. Will need to consider the time investment needed to "do this right", which I think is worthwhile.

@cfergeau
Copy link
Author

cfergeau commented Nov 19, 2024

I found this tauri/flatpak application on flathub which is using tauri build, it's probably possible to reuse some of what it's doing
https://github.com/flathub/io.github.vemonet.EmojiMart/blob/master/io.github.vemonet.EmojiMart.yml

@cfergeau
Copy link
Author

cfergeau commented Nov 20, 2024

probably disqualify this from actually getting submitted to flathub

This apparently is not a problem, Volaris is doing exactly this (download the .deb and generate the flatpak from its content) and is distributed on flathub.
With that said, I agree it would be cleaner to generate the flatpak directly from the git source code or from a source tarball.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants