Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions docs/flatpak/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

How to build and update the Flatpak package.

> [!WARNING]
> [!NOTE]
>
> ## IMPORTANT: PNPM LOCKFILES ARE NOT SUPPORTED IN FLATPAK-BUILDER-TOOLS YET
>
> Flatpak dependency source generation still relies on compatibility lockfiles
> such as npm and Yarn, not `pnpm-lock.yaml`.
>
> - [Flatpak Builder Tools PR 511]
> - [Flatpak Builder Tools issue 383]
> `flatpak-builder-tools` added `pnpm-lock.yaml` support in
> [Flatpak Builder Tools PR 511], closing [Flatpak Builder Tools issue 383].
> Vortex's Flatpak manifest and helper scripts use this pnpm path for
> `flatpak/generated-sources.json` generation.

> [!note] Prerequisites
> See [Flatpak packaging] for the basics and
Expand Down Expand Up @@ -110,7 +107,7 @@ Current baselines:

- Runtime: `org.freedesktop.Platform` 25.08
- BaseApp: `org.electronjs.Electron2.BaseApp` 25.08
- Node SDK: `org.freedesktop.Sdk.Extension.node22`
- Node SDK: `org.freedesktop.Sdk.Extension.node24`
- .NET SDK: `org.freedesktop.Sdk.Extension.dotnet9`

## generated-sources.json, generated-nuget-sources.json & Offline Build Behaviour
Expand All @@ -126,7 +123,7 @@ This is required for _Flathub submission_ and ensures reproducible builds.

To keep source files in sync automatically, build scripts now:

- hash recursive repository `yarn.lock` files and compare against
- hash the repository `pnpm-lock.yaml` file and compare against
`flatpak/generated-sources.hash`
- hash FOMOD `.csproj` and NuGet input files and compare against
`flatpak/generated-nuget-sources.hash`
Expand All @@ -141,7 +138,7 @@ python3 flatpak/scripts/flatpak_sources.py
If you are debugging `generated-sources.json` generation, you can run the sync script manually:

```bash
python3 flatpak/scripts/flatpak_sources.py --only yarn --force
python3 flatpak/scripts/flatpak_sources.py --only pnpm --force
```

If you are debugging `generated-nuget-sources.json` generation, run:
Expand All @@ -155,10 +152,9 @@ you need to narrow the scope during debugging.

## Troubleshooting

- Missing submodule files during Flatpak build: `yarn install` normally runs
- Missing submodule files during Flatpak build: `pnpm install` normally runs
`preinstall.js`, which initializes submodules. If you have not run
`yarn install` locally, run `git submodule update --init --recursive`
first
`pnpm install` locally, run `git submodule update --init --recursive` first
- `nxm://` handler did not switch automatically:

```bash
Expand Down
19 changes: 9 additions & 10 deletions docs/flatpak/technical.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Technical notes for developers working on the Flatpak build.

## Build Pipeline

Offline-first: `flatpak-node-generator` converts Yarn lockfiles into
`generated-sources.json` so builds need no network. Yarn pulls from an offline
mirror inside the sandbox.
Offline-first: `flatpak-node-generator` converts `pnpm-lock.yaml` into
`generated-sources.json` so builds need no network. pnpm installs from an
offline store inside the sandbox.

Build stages (in the SDK sandbox):

1. `yarn install` -- offline dependency fetch
1. `pnpm install --offline` -- offline dependency fetch
2. `_install_app`, `subprojects_app`, `_assets_app`, `build_dist` -- compile to `app/`
3. `electron-builder` -- package app with Electron runtime to `dist/linux-unpacked/`
4. Copy `dist/linux*-unpacked/` to `/app/main`
Expand Down Expand Up @@ -45,12 +45,11 @@ This approach:

Use this to test the actual user installation experience.

## Yarn Config (`flatpak/yarnrc`)
## pnpm Config

- `child-concurrency 1` -- deterministic, avoids cache races
- `yarn-offline-mirror` -- tarball store inside the sandbox
- `yarn-offline-mirror-pruning false` -- don't delete needed tarballs
- `cache-folder` -- writable cache in the sandbox
- `npm_config_store_dir` -- pnpm content-addressable store inside the sandbox
- `npm_config_cache` -- writable package manager cache in the sandbox
- `npm_config_offline` -- prevent network dependency resolution during the build

## Launch Mechanism

Expand All @@ -67,7 +66,7 @@ Use this to test the actual user installation experience.
and deployment are background operations that cannot wait for user prompts.

- **Offline builds**: Required for Flathub and reproducible builds. All
Yarn and NPM dependencies must be in `generated-sources.json`.
pnpm and NPM dependencies must be in `generated-sources.json`.

- **Zypak wrapper**: Required by the Electron BaseApp to run Chromium's
sandbox inside Flatpak's sandbox.
Expand Down
6 changes: 3 additions & 3 deletions docs/packaging/flatpak.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Use this page when you need to build, install, or bundle the Flatpak package.

> [!WARNING]
> Flatpak is broken right now.
> `pnpm` support in Flatpak still needs fixing.
> [!NOTE]
> Flatpak dependency source generation uses upstream `flatpak-builder-tools`
> `pnpm-lock.yaml` support.

## Flatpak Basics (Linux Packaging)

Expand Down
28 changes: 14 additions & 14 deletions flatpak/com.nexusmods.vortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ build-options:
# Ref: https://github.com/electron/electron/blob/main/docs/api/environment-variables.md
ELECTRON_SKIP_BINARY_DOWNLOAD: "1"

# Node/Yarn offline cache locations for reproducible builds.
# Node/pnpm offline cache locations for reproducible builds.
# Flatpak builds run offline by default; these paths are inside the build sandbox.
# Ref: https://docs.flatpak.org/en/latest/electron.html#the-application-module
npm_config_cache: /run/build/vortex/flatpak-node/npm-cache
npm_config_nodedir: /usr/lib/sdk/node24
npm_config_offline: "true"
npm_config_store_dir: /run/build/vortex/flatpak-node/pnpm-store
XDG_CACHE_HOME: /run/build/vortex/flatpak-node/cache
YARN_CACHE_FOLDER: /run/build/vortex/flatpak-node/yarn-cache
YARN_IGNORE_ENGINES: "1"
YARN_OFFLINE_MIRROR: /run/build/vortex/flatpak-node/yarn-mirror
YARN_OFFLINE_MIRROR_PRUNING: "false"
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

# Dotnet SDK settings for build-time tools (runtime DOTNET_ROOT is set via finish-args).
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
Expand All @@ -42,6 +40,7 @@ build-options:
# Skip git submodule updates (submodules are already fetched by flatpak-builder).
# FOMOD installer builds are still needed and run during preinstall.
NO_PARALLEL: "1"
VORTEX_DUCKDB_EXTENSION_SOURCE_DIR: /run/build/vortex/flatpak-duckdb-extensions
VORTEX_SKIP_SUBMODULES: "1"

finish-args:
Expand Down Expand Up @@ -82,8 +81,7 @@ modules:
build-commands:
# Steps match `.github/workflows/package.yml` where possible.

# Configure Yarn for Flatpak caches, then install dependencies.
- cp flatpak/yarnrc .yarnrc
# Configure NuGet for offline dependency resolution.
- |
cat > NuGet.Config <<'EOF'
<?xml version="1.0" encoding="utf-8"?>
Expand All @@ -94,19 +92,20 @@ modules:
</packageSources>
</configuration>
EOF
- yarn install --non-interactive --check-files --frozen-lockfile
- python3 flatpak/scripts/flatpak_prepare_pnpm.py
- pnpm install --frozen-lockfile --offline
# Build the app following the standard workflow from CONTRIBUTE.md.
- yarn run build
- pnpm run build

# Prepare app/ directory for packaging
- yarn run _install_app
- yarn run subprojects_app
- yarn run _assets_app
- yarn run build_dist
- pnpm run _install_app
- pnpm run subprojects_app
- pnpm run _assets_app
- pnpm run build_dist

# Build Electron distribution with electron-builder (dir target)
# This creates dist/linux-unpacked/ with the electron binary bundled
- yarn electron-builder --config electron-builder-config.json --publish never --linux dir
- pnpm exec electron-builder --config electron-builder-config.json --publish never --linux dir

# Install the launcher, desktop file, icon, and metainfo into the Flatpak image.
- install -Dm755 flatpak/run.sh /app/bin/run.sh
Expand All @@ -122,3 +121,4 @@ modules:
path: ..
- generated-sources.json
- generated-nuget-sources.json
- generated-duckdb-sources.json
1 change: 1 addition & 0 deletions flatpak/generated-duckdb-sources.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bb1a5dbed77509ad72025cf442903450cb7ed5894003080d65d9620dc775fe05
16 changes: 16 additions & 0 deletions flatpak/generated-duckdb-sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"type": "file",
"url": "https://nexus-mods.github.io/duckdb-level-pivot/current_release/v1.5.1/windows_amd64/level_pivot.duckdb_extension.gz",
"sha256": "c4ee070ec4a5a9a07dfd1d9369c08a8af02b18bd280db5c0924686dd04578359",
"dest": "flatpak-duckdb-extensions/v1.5.1/windows_amd64",
"dest-filename": "level_pivot.duckdb_extension.gz"
},
{
"type": "file",
"url": "https://nexus-mods.github.io/duckdb-level-pivot/current_release/v1.5.1/linux_amd64/level_pivot.duckdb_extension.gz",
"sha256": "013859c55af64a76e47a0493a682a121d29fce1f65c91e3ceb7aa0611ccba43a",
"dest": "flatpak-duckdb-extensions/v1.5.1/linux_amd64",
"dest-filename": "level_pivot.duckdb_extension.gz"
}
]
2 changes: 1 addition & 1 deletion flatpak/generated-sources.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8943935d66eca9b3bb6bd4f7e75b54e347047f90bceae68e29a6a2c03efa8b52
7565af8205b1680625cea192768a646200486b1cd5b0d30673ccffae0acbff4d
Loading