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

[Linux] Add flatpak #7

Open
arctixdev opened this issue Aug 21, 2023 · 14 comments
Open

[Linux] Add flatpak #7

arctixdev opened this issue Aug 21, 2023 · 14 comments
Labels
enhancement New feature or request

Comments

@arctixdev
Copy link
Member

A flatpak file for installation would be extremely nice since we could add it to FlatHub which would make the app way more accessible for Linux users (Since appimages are kinda annoying to run). RPM would be nice as well

Tauri dosn't currently support bundling to a flatpak though... See tauri-apps/tauri#3619

@arctixdev arctixdev added the enhancement New feature or request label Aug 21, 2023
@freundTech
Copy link

freundTech commented May 10, 2024

There is a working tauri app on flathub here: https://github.com/flathub/in.cinny.Cinny
I've looked into how their build works and am currently trying to build MA Companion this way.

EDIT: I got basic functionality working, but there are some problems to be worked out before submitting to flathub. Code is here: https://github.com/freundTech/flathub/tree/add-music-assistant-companion

  • Build squeezelite from source
  • Squeezelite doesn't connect to server (works with ipv4. ipv6 doesn't work because HAOS doesn't support it)
  • Resolving mDNS Adresses (homeassistant.local) doesn't work (dependency/sandbox?)
  • Title bar doesn't match dark theme preference (content also doesn't match, but this is a tauri bug, not related to flatpak packaging)
  • Missing fonts (webfont-dl can't download fonts during build. Provide them in advance somehow)
  • Missing appstream metadata

@arctixdev
Copy link
Member Author

That is super cool! If you need any help or have questions feel free to reach out! Either here or on the Discord

@freundTech
Copy link

To be published on flathub music-assistant will need an appstream metainfo file. That file includes all the information that will be shown on flathub.org and your distro's software manager, such an name, description, icon, screenshots, ...

While it's possible to keep the appstream metadata with the flatpak build manifest, it is preferred to keep it upstream, so in this repository.

I can also create the file once I have the packaging working, but it would probably be better if someone with more experience with music-assistant would create the file and commit it upstream.

https://docs.flathub.org/docs/for-app-authors/metainfo-guidelines/

@freundTech
Copy link

freundTech commented May 10, 2024

Also music-assistant-companion contains a self-updater, which should be disabled when installing from flathub. I can just patch that out, but it would be easier if it were exposed as a cargo feature.

@arctixdev
Copy link
Member Author

arctixdev commented May 11, 2024

Hey @freundTech, I created the metainfo file now! Again, thanks a bunch for creating the flatpak!
About the updater, I am quite new to rust so you probably know more than me on the topic. But I think it a cargo feature already https://github.com/music-assistant/companion/blob/main/src-tauri/Cargo.toml#L17

@freundTech
Copy link

Thanks. I'll integrate the metainfo into the build.

The tauri updater itself is an optional feature of the tauri crate, however MA Companion adds some UI on top (At least the update button in the system menu and the check for updates button in the setting panel).
It would be great to have those hidden behind a feature on the music-assistant-companion crate. The tauri feature can then be set to be a dependency of the music-assistant-companion feature.

I'm not that experience with rust myself, so I would have to look up the details for how to do this myself. For now I'm just using a patch in the flatpak build: https://github.com/freundTech/flathub/blob/add-music-assistant-companion/0001-disable-tauri-updater.patch

@fabsau
Copy link

fabsau commented May 17, 2024

I don't want to create a separate issue for that, but how about adding it to Homebrew (for Mac Users) and Chocolatey/WinGet for Windows users?

@arctixdev
Copy link
Member Author

Yeah, I dont really have much experience with that myself. But I did try creating a homebrew package, but i dont know if it works. Right now I am trying to publish the app to the app store for mac.

@arctixdev
Copy link
Member Author

Hey @freundTech, how is it going with the flatpak bundle? Please don't hesitate to reach out if you need any help 🙂

@freundTech
Copy link

freundTech commented May 22, 2024

I was busy with exams last week. Have some more time now.
The main problem is that mDNS currently doesn't work in flatpak (there is an upstream issue for this).

I think that I might be able to hack around it using LD_PRELOAD. If not we would need to patch in a notice that using homeassistant.local doesn't work and that you need to use the IP address instead.

@arctixdev
Copy link
Member Author

Ah, cool! Yeah I'm also busy with exams at the moment 😄 Don't stress it if you don't have the time!

I don't have experience with flatpak or xdg, if you dont get mDNS to work, that's totally fine. We can just add a notice as you suggested.

@arctixdev
Copy link
Member Author

arctixdev commented Jun 7, 2024

FYI i switched the companion app to the 2.0 beta, meaning some stuff probably changed. But there seems to be a simple guide to creating the flatpak for v2 https://deploy-preview-1760--tauri-v2.netlify.app/guides/distribute/flatpak/
Though it hasnt been merged yet

@freundTech
Copy link

I took a quick look at that page and the template they offer. The main problem I see with it is that they don't build in a flatpak sandbox, but build on the host and then just copy the binary to the flatpak sandbox. This might be fine if you want to distribute the flat pack directly, but isn't going to get you onto flathub (which requires all flatpaks to be built in their CI without internet access at built time).

Building outside the sandbox could also potentially lead to linking against wrong versions of system libraries.

Also you would need to adjust their template to also copy squeezelite over (which my WIP build script builds from source)

@arctixdev
Copy link
Member Author

Yeah, that was also the impression, I got. If you need any help, just reach out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants