Skip to content

build from source: Yarn 4 Berry + Rust napi + Electron Forge offline …#99

Draft
the-narwhal wants to merge 7 commits intoflathub:masterfrom
the-narwhal:build-from-source-2026
Draft

build from source: Yarn 4 Berry + Rust napi + Electron Forge offline …#99
the-narwhal wants to merge 7 commits intoflathub:masterfrom
the-narwhal:build-from-source-2026

Conversation

@the-narwhal
Copy link
Copy Markdown

Build from source

Replaces the binary .deb wrapper with a complete offline build from the
upstream ProtonMail/WebClients
monorepo at tag proton-pass@1.36.0.

Build stack

  • Package manager: Yarn 4 Berry (node-modules linker)
  • JS bundler: webpack 5 via Electron Forge 7 + @electron-forge/plugin-webpack
  • Native code: two Rust crates in applications/pass-desktop/native/
    compiled with @napi-rs/cli (NAPI addon) and cargo (native messaging host)
  • SDK extensions: org.freedesktop.Sdk.Extension.node22,
    org.freedesktop.Sdk.Extension.rust-stable

Patches (3 files)

Patch Reason
remove-private-registries.patch Strips Proton-internal npm scopes (@tpe, @proton-meet, @proton/…@npm:) from .yarnrc.yml — all @proton/* packages are workspace-local; these entries are stale and unreachable from the sandbox
fix-native-build.patch Removes rustup target add calls (requires network + writable RUSTUP_HOME) and restricts Linux targets to the native arch with glibc; musl is not needed in a Flatpak runtime
fix-forge-electron-cache.patch Adds electronZipDir to packagerConfig in forge.config.ts so @electron/packager uses the pre-fetched Electron zip directly instead of calling @electron/get; env var only set in the Flatpak sandbox, normal builds unaffected

Generated source files

  • generated-sources.json — produced by flatpak-node-generator yarn WebClients/yarn.lock
  • cargo-sources.json — produced by flatpak-cargo-generator.py …/native/Cargo.lock

Desktop/metainfo

me.proton.Pass.desktop and the updated me.proton.Pass.metainfo.xml are
carried in this repo for now. A separate PR to ProtonMail/WebClients is
being opened to upstream them into applications/pass-desktop/assets/.

Tested on

  • aarch64 (local build + run confirmed)
  • x86_64 (Flathub CI)

…build

Replaces the binary .deb wrapper with a complete from-source build.
- generated-sources.json: 4277 pre-fetched JS/Node/Electron packages (flatpak-node-generator)
- cargo-sources.json: 527 pre-fetched Rust crates (flatpak-cargo-generator)
- remove-private-registries.patch: strips unreachable Proton internal npm scopes from .yarnrc.yml
- fix-native-build.patch: removes rustup target add, restricts to native arch glibc target
- fix-forge-electron-cache.patch: adds electronZipDir to forge.config.ts to bypass @electron/get
- me.proton.Pass.desktop: new desktop entry (pending upstream PR to ProtonMail/WebClients)
- filter-yarn-lock.py: helper script for re-generating sources on version bumps
- flathub.json: drops x86_64-only restriction (both arches now supported)
- metainfo: updated disclaimer to canonical form, added release notes for recent versions"
@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Test build enqueued.

@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Started test build.

@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Test build enqueued.

@flathubbot
Copy link
Copy Markdown
Contributor

Test build was cancelled.

Help
  • bot, build - Restart the test build
  • bot, ping admins - Contact Flathub admins

@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Started test build.

@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Test build enqueued.

@flathubbot
Copy link
Copy Markdown
Contributor

Test build was cancelled.

Help
  • bot, build - Restart the test build
  • bot, ping admins - Contact Flathub admins

@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Started test build.

@flathubbot
Copy link
Copy Markdown
Contributor

Test build succeeded. To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/274127/me.proton.Pass.flatpakref

Built for aarch64 and x86_64 architectures.

@proletarius101
Copy link
Copy Markdown
Collaborator

Thanks! Does it work already?

@the-narwhal
Copy link
Copy Markdown
Author

Yes ish. I had to pause progress before I got it fully completed. There's also some monorepo challenges that still need sorted out.

I'd call it a work in progress for now. And I'll come back to it in early May when time is more available.

@D-Bao
Copy link
Copy Markdown

D-Bao commented Apr 17, 2026

Hi, I just saw your PR in Proton monorepo, thanks for this!
If the monorepo challenges happened during yarn install where you got:
Error: @rowsncolumns/charts@workspace:^: Workspace not found (@rowsncolumns/charts@workspace:^)
then it's an issue from Proton Docs which is a separate product and we don't need it to build Proton Pass. You can do the following workaround:

  1. open the file applications/docs-editor/package.json
  2. remove the lines starting with @rowsncolumns (lines 52 to 58)

@the-narwhal
Copy link
Copy Markdown
Author

Appreciated! The work you're doing upstream and the feedback here are very helpful!

Ultimate goal is to get Authenticator approved on flathub and building in both x86 and arm64 (selfishly I need arm64 for my x1e machine). Then ideally go proton app by proton app on flathub and uplift them to build from source in both too.

applications/docs-editor/package.json references seven @rowsncolumns/*
packages via workspace:^ — but those are private/external packages not
present in the monorepo. Yarn Berry raises:

  Workspace not found (@rowsncolumns/charts@workspace:^)

even when docs-editor is already excluded from the active workspace list
by the preceding filter step, because it still scans the lockfile entries.

Remove all @rowsncolumns/* entries from docs-editor's dependencies as a
defensive measure. Approach suggested by D-Bao (Proton) in flathub#99.

Also add test-repo/ to .gitignore.
@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Test build enqueued.

@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Started test build.

generated-sources.json:
- Strip 10 Playwright browser binary entries (5 cdn.playwright.dev
  archives + 5 companion inline symlink scripts). These test-only
  downloads are never used during the Flatpak build and waste several
  hundred MB of bandwidth. The @playwright/test npm tarballs are kept
  since Yarn needs them in the offline cache for lockfile resolution.

fix-native-build.patch:
- Replace the arm64-or-x86_64 ternary with an archMap lookup that
  correctly handles arm (armv7-unknown-linux-gnueabihf) in addition
  to aarch64 and x86_64.

flathub.json:
- Restrict to only-arches: [x86_64, aarch64]. arm32 is untested for
  an app this size; this prevents a potential Flathub CI failure on
  armv7l builders.

me.proton.Pass.yml:
- Rename PREREQUISITES block to MAINTENANCE and remove stale "empty
  stubs" language; files are committed and populated. Add the
  Playwright-strip one-liner to the regeneration instructions.
- Clarify yarn install comment: explain --mode=skip-build and the
  omission of --immutable separately, since they are independent flags.
- Correct the comment for fix-forge-electron-cache.patch: the patch
  adds packagerConfig.electronZipDir / FLATPAK_ELECTRON_ZIP_DIR, not
  download.cacheRoot / FLATPAK_ELECTRON_CACHE.
@flathubbot
Copy link
Copy Markdown
Contributor

Test build succeeded. To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/279062/me.proton.Pass.flatpakref

Built for aarch64 and x86_64 architectures.

Adds .github/workflows/regenerate-sources.yml, a manually-triggered
(workflow_dispatch) GitHub Actions workflow for use when the Flathub
external-data-checker opens a version-bump PR.

The workflow accepts a branch name as input, then:
  - reads the new upstream tag written by the checker into the manifest
  - sparse-checks out only yarn.lock and Cargo.lock from WebClients,
    avoiding a full clone of the multi-GB monorepo
  - regenerates generated-sources.json via flatpak-node-generator and
    strips Playwright browser binaries (not needed at build time)
  - regenerates cargo-sources.json via flatpak-cargo-generator
  - detects any Electron version change in the fresh sources and patches
    all four hardcoded occurrences in the manifest: EHASH, both EZIP
    lines, SHASUMS256.txt suffix, and the explanatory comment
  - commits the results back to the PR branch

Includes guards for empty NEW_VER and a failed tag-pattern match.
me.proton.Pass.yml:
  - install WebClients LICENSE to share/licenses/me.proton.Pass/LICENSE;
    flatpak-builder cannot auto-install it for simple-buildsystem modules
  - document --device=all as required for FIDO2/U2F hardware security
    key support (/dev/hidraw*); no portal exists for this yet

me.proton.Pass.metainfo.xml:
  - correct project_license from GPL-3.0 to GPL-3.0-only; confirmed
    against upstream WebClients/LICENSE (GPL v3 only, not "or later");
    bare GPL-3.0 is deprecated in SPDX 3.x
  - remove xml:lang="en" from <screenshot> element; AppStream does not
    permit it there — it belongs on <image> and <caption> children
  - add <url type="bugtracker"> pointing to the WebClients issue tracker

me.proton.Pass.desktop:
  - add Security; to Categories (matches KeePassXC, Bitwarden, et al.)
  - add Keywords for discoverability in software centres
@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Test build enqueued.

@flathubbot
Copy link
Copy Markdown
Contributor

🚧 Started test build.

@flathubbot
Copy link
Copy Markdown
Contributor

Test build succeeded. To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/279078/me.proton.Pass.flatpakref

Built for aarch64 and x86_64 architectures.

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.

4 participants