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

feat: Flatpak #104

Merged
merged 3 commits into from
Dec 11, 2023
Merged

feat: Flatpak #104

merged 3 commits into from
Dec 11, 2023

Conversation

theHamsta
Copy link

I experimented with creating a flatpak manifest for neovim-gtk. For testing purposes I included the manifest in this PR though it is not indented to live in this repo and to be submitted to flathub instead.

Please let me know whether you are interested in publishing a Flatpak for neovim-gtk.

To test:

flatpak install org.gnome.Sdk/x86_64 # I selected version 45
flatpak install org.freedesktop.Sdk.Extension.rust-stable/x86_64 # I selected 23.08
flatpak-builder flatbuild com.github.Lyude.neovim-gtk.yaml --force-clean --install --user

@theHamsta theHamsta marked this pull request as draft October 28, 2023 15:46
@Lyude
Copy link
Owner

Lyude commented Oct 30, 2023

Yep - I'd definitely been interested in this :)

@theHamsta theHamsta force-pushed the flatpak branch 26 times, most recently from 241d4a6 to 1667ddc Compare October 30, 2023 20:27
@theHamsta theHamsta force-pushed the flatpak branch 8 times, most recently from 02643c5 to 81cb7ba Compare November 3, 2023 22:07
@Lyude
Copy link
Owner

Lyude commented Nov 3, 2023

BTW - I wanted to clarify that you've been using the draft status to mark things before they're ready for me to review, right? Or did you want me to go through and give some feedback as-is?
I realized I should explicitly ask this at least once, since a few of your PRs have been on draft for a while (no problem if they just haven't been ready yet and you're busy :)

@theHamsta
Copy link
Author

theHamsta commented Nov 3, 2023

BTW - I wanted to clarify that you've been using the draft status to mark things before they're ready for me to review, right? Or did you want me to go through and give some feedback as-is? I realized I should explicitly ask this at least once, since a few of your PRs have been on draft for a while (no problem if they just haven't been ready yet and you're busy :)

The draft status is mainly about the manifest for which I haven't found a good way to test how it would look like in app stores and on Flathub itself without uploading it (and also because I didn't have time every day). Also 61a84b7 still shows a few lints (e.g. it doesn't like com.github app id, or dbus access can maybe be restricted). The description could also explain that a host nvim is still needed. The build is probably ok. An additional step that could be possible could be to run strip on the binary to reduce binary size.

There are a few approaches on how we could move that PR forward:

  1. you have experience with flatpak packaging and can review my noob errors
  2. you just submit an initial version to flatpak and do a refresh of the flatpak if some of the metadata looks a bit of in app centers
  3. I'd submit PRs to other Neovim GUIs to collect more experience (wanted to submit to neovim-qt and Neovide)

If you're fine to review you can probably go with 2. The current manifest could look like this with the SHA of the current PR commit

app-id: com.github.Lyude.neovim-gtk
runtime: org.gnome.Platform
runtime-version: '45'
sdk: org.gnome.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.rust-stable
command: nvim-gtk
finish-args:
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --device=dri
- --socket=session-bus # for `flatpak-spawn --host nvim`
build-options:
  append-path: "/usr/lib/sdk/rust-stable/bin"
  build-args:
  - "--share=network" # for cargo fetching dependencies
  env:
    CARGO_HOME: "/run/build/neovim-gtk" # for caching 
    CARGO_ARGS: "--features flatpak"
    PREFIX: "/app"
modules:
- name: neovim-gtk
  buildsystem: simple
  build-commands:
  - make install-flatpak
  sources:
  - type: archive
    url: https://github.com/Lyude/neovim-gtk/archive/8b700b9080ec309b9f0b0687b74e2fb95bde0773.tar.gz
    sha256: 7f7764713cf9c6e622362a42b55a491ece09120cdcd9643efa250f5310ca4195

https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Application.html KDE projects, or OBS have example of the metadata xml.

@theHamsta theHamsta marked this pull request as ready for review November 3, 2023 23:15
@theHamsta
Copy link
Author

theHamsta commented Nov 4, 2023

Access to the entire bus with --socket=system-bus or --socket=session-bus should be avoided, unless the application is a development tool.

I guess the "development tool" apply to neovim-gtk. Probably session-bus could be restricted to just allow flatpak-spawn nvim (--talk-name=???). Having nvim within the flatpak (which I tried earlier) is a bit of a weird experience since not all paths in the flatpak environment are the same as of the host and it's difficult to get access to CLI tools like git.

https://docs.flatpak.org/en/latest/sandbox-permissions.html#d-bus-access

@theHamsta
Copy link
Author

theHamsta commented Nov 4, 2023

--socket=session-bus can be replaced by - --talk-name=org.freedesktop.Flatpak # for flatpak-spawn --host nvim. Maybe also https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-org.freedesktop.portal.Flatpak

@theHamsta
Copy link
Author

theHamsta commented Nov 5, 2023

@Lyude
Copy link
Owner

Lyude commented Nov 20, 2023

(sorry I haven't gotten to this yet btw! Will try to do so soon, got distracted this last weekend trying to fight 3D printer problems…)

@Lyude Lyude merged commit 5cb8f95 into Lyude:main Dec 11, 2023
3 checks passed
@theHamsta
Copy link
Author

Sorry, that the yaml was included the latest commit. I actually thought that I had excluded it but maybe I added it again during some rebase. Are you planning to submit the yaml to https://github.com/flathub/flathub?

@Lyude
Copy link
Owner

Lyude commented Dec 11, 2023

Sorry, that the yaml was included the latest commit. I actually thought that I had excluded it but maybe I added it again during some rebase. Are you planning to submit the yaml to https://github.com/flathub/flathub?

It's no problem! And yes - I will get to submitting this ASAP :), I realized I still needed to do that after hitting merge

@Lyude
Copy link
Owner

Lyude commented Jan 8, 2024

ok - back from vacation, and finally got my printer in a state where it's not throwing me problems constantly. will actually get to this in the next few days, sorry for the delay!

@Lyude
Copy link
Owner

Lyude commented Jan 18, 2024

Been looking into trying to build this today btw and I've been hitting these errors:

➜  neovim-gtk git:(main) ✗ flatpak-builder flatbuild com.github.Lyude.neovim-gtk.yaml --force-clean --install --user        
Downloading sources
Starting build of com.github.Lyude.neovim-gtk
Cache hit for neovim-gtk, skipping build
Cache miss, checking out last cache hit
Cleaning up
Running appstreamcli compose
Only accepting components: com.github.Lyude.neovim-gtk, com.github.Lyude.neovim-gtk.desktop
Processing directory: /home/lyudess/Projects/neovim-gtk/neovim-gtk/.flatpak-builder/rofiles/rofiles-AYp8c3/files
Composing metadata...
Run failed, some data was ignored.
Errors were raised during this compose run:
general
  E: filters-but-no-output

com.github.Lyude.neovim-gtk
  E: metainfo-license-invalid
Refer to the generated issue report data for details on the individual problems.
Error: ERROR: appstreamcli compose failed: Child process exited with code 1

I'm looking into it as well to see if I can figure out the issue, it definitely seems like flatpak builder's UX is unfortunately very lacking (I haven't found any results for either error on DDG. I assume I need to correct a license tag somewhere?)

@Lyude
Copy link
Owner

Lyude commented Jun 14, 2024

Hey @theHamsta sorry it's taken me so long to ask - but would you possibly be willing to take over maintaining the flatpak for this?

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

Successfully merging this pull request may close these issues.

2 participants