Skip to content

486 add linux to flat hub #487

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

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

Conversation

Thorian1te
Copy link
Collaborator

No description provided.

@Thorian1te Thorian1te linked an issue Nov 11, 2024 that may be closed by this pull request
@beemdvp
Copy link

beemdvp commented Dec 23, 2024

Excited to see this release 🎉

@@ -0,0 +1,29 @@
id: org.asgardex.desktop
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the application ID be something like com.asgardex.asgardex-desktop? asgardex.com is the project's domain, and the Flathub rules also say not to end an ID with .desktop.

https://www.asgardex.com/

https://docs.flathub.org/docs/for-app-authors/requirements#application-id

  • The ID must not end in generic terms like .desktop or .app. It's fine to repeat the application name in such cases.

https://docs.flathub.org/docs/for-app-authors/requirements#control-over-domain-or-repository

  • The domain must be directly related to the project or the application being submitted and the author or the developer or the project must have control over the domain. The corresponding URL must be reachable over HTTP(S).

@@ -0,0 +1,29 @@
id: com.asgardex.asgardex-desktop
runtime: org.freedesktop.Platform
runtime-version: '22.08'
Copy link
Collaborator

@dynst dynst Mar 7, 2025

Choose a reason for hiding this comment

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

Comment on lines 25 to 29
- name: electron-dependencies
buildsystem: simple
build-commands:
- npm install -g [email protected]
- cp -R $(npm root -g)/electron /app/lib
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of redundantly installing and bundling Electron, is it possible to just use the already-packaged Electron BaseApp, with the steps outlined here?

https://docs.flatpak.org/en/latest/electron.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah definitely

- --device=dri
- --socket=pulseaudio
- --share=network
- --filesystem=home
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's actually no reason this needs read/write access to the whole home directory, is there? All user-imported files just go through the file picker portal, right?

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

Since flatpak gives the sandboxed app its own $XDG_CONFIG_HOME, if Electron uses $XDG_CONFIG_HOME to determine the appData directory, everything should just work without any permissions or code changes at all: STORAGE_DIR will end up as ~/.var/app/com.asgardex.asgardex-desktop/config/ASGARDEX/storage/.

https://www.electronjs.org/docs/latest/api/app#appgetpathname

export const APP_DATA_DIR = path.join(app?.getPath('appData') ?? './testdata', APP_NAME)
export const STORAGE_DIR = path.join(APP_DATA_DIR, 'storage')

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you are more than welcome to help get this PR completed. As displayed this is not my area of expertise 😮‍💨.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would but I only have read-only permissions here 😅

Just deleting the entire --filesystem=home line should be fine though.

Copy link
Collaborator

@dynst dynst left a comment

Choose a reason for hiding this comment

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

There's an issue with dependencies: the line that runs yarn install --immutable looks like it fails in the Fetch step, because in the build sandbox there is no network access. The only way to download dependencies is to declaratively specify them as sources, which get downloaded before the build sandbox runs.

Other projects like yarn-flatpak-demo and DOS Browser additionally make use of the obsolete yarn --offline option and the yarn-offline-mirror config. But their repos use Yarn Classic, while Asgardex uses Yarn Modern, which removed those, so copying the same solution wouldn't work here.

(YARN_ENABLE_OFFLINE_MODE=1 looks like it might be relevant? But it doesn't solve the problem.)

The right solution is probably using a tool called flatpak-node-generator to pin all the dependencies, which get specified as 'sources' in the syntax that flatpak understands (generated-sources.json), so that flatpak-builder will simply download all your dependencies beforehand.

@dynst
Copy link
Collaborator

dynst commented Apr 29, 2025

Looking into it, combining Yarn & flatpak is actually currently hard to do 'the right way,' building from source, because the existing tooling only supports Yarn Classic (Yarn 1).

There's been a PR open since 2021 that'll add support for Yarn 2 and Yarn 3, but even it doesn't add support for Yarn 4 (what asgardex currently uses): flatpak/flatpak-builder-tools#252 (comment)

The workaround would be to have flatpak download already-built .js/.css bundles, copy them where the Electron BaseApp will run them, and skip any real build process entirely (for now).

@Thorian1te Thorian1te requested a review from dynst May 7, 2025 05:38
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.

Add linux to flat hub
3 participants