Skip to content

feat(com.visualstudio.code): add Visual Studio Code (com.visualstudio.code) - #922

Merged
jing2uo merged 6 commits into
flatpark:mainfrom
francoism90:com.visualstudio.code
Oct 31, 2026
Merged

jing2uo merged 6 commits into
flatpark:mainfrom
francoism90:com.visualstudio.code

Conversation

@francoism90

@francoism90 francoism90 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

This is my fork of the frequently out-of-date flathub/com.visualstudio.code on Flathub:

  • Custom Electron flags: code-flags.conf is read at startup.
  • GnuPG agent access: xdg-run/gnupg is mounted read-only, so commit signing with your host's gpg-agent works.
  • KDE theming: xdg-config/kdeglobals is mounted read-only, so the window follows your Plasma color scheme.
  • TMPDIR: set to $XDG_RUNTIME_DIR/app/com.visualstudio.code, the per-app runtime directory that is also visible from the host, instead of the sandbox's own /tmp.
  • NixOS shells: /etc/shells is resolved through /etc/static/shells on NixOS hosts, so the integrated terminal finds host shells.
  • host-spawn: upstream's release binaries, pinned as a second extra-data download.
  • No krb5, so no Kerberos/Negotiate SSO, same as com.google.Chrome and com.brave.Origin.

The runtime stays org.freedesktop.Sdk instead of the Platform. Only the Sdk declares the org.freedesktop.Sdk.Extension mount point (flatpak info -m org.freedesktop.Platform//26.08 has no such entry), so on the Platform no SDK extension (golang, dotnet, podman, …) mounts and FLATPAK_ENABLE_SDK_EXT does nothing. Nothing is built against it; the app is still extra-data only.

@francoism90 francoism90 changed the title feat: add Visual Studio Code Flatpak package with necessary configura… feat(com.visualstudio.code): add Visual Studio Code (com.visualstudio.code) Oct 31, 2026

@jing2uo jing2uo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this! VS Code fits here: the Flathub package is third-party (not verified) and sits at 1.139.1 while upstream is at 1.144.0, so it qualifies under apps already on Flathub. The extras (code-flags.conf, gpg-agent, TMPDIR, NixOS shells) are welcome too.

The manifest is still shaped for Flathub, though, and FlatPark works differently in a few places. These need to change before we can merge:

1. No source builds. FlatPark is extra-data only: nothing gets compiled into /app (limits). That rules out the kerberos and host-spawn modules and the golang SDK extension.

  • host-spawn: pin upstream's release binaries (x86_64/aarch64) as a second extra-data source, as the Flathub manifest does already (it pins them as type: file).
  • krb5: our Chromium-based packages (com.google.Chrome, com.brave.Origin) ship without it and say so in a manifest comment. If Kerberos/Negotiate SSO matters to you, it would go through flatpark/prebuilt, not into this manifest.

2. flatpark.yml and resolve-update.sh are missing. Our CI ignores x-checker-data. A resolver tells it the latest version, then it re-pins the .deb and adds the metainfo release on its own (descriptor, updates). With that in place, the metainfo only needs the current release, not the history copied from Flathub.

3. Declare the high-risk permissions. --filesystem=host, --device=all and especially --talk-name=org.freedesktop.Flatpak (host-spawn's sandbox escape) all go under policy.dangerous_permissions with a short reason (how). registry/ai.z.zcode/flatpark.yml is a close example. Since code.sh changes how the app runs (extra flags, TMPDIR, the /etc/shells links), please declare that as well (changes to how the app runs).

4. Unpack the .deb with bsdtar. The Platform has no ar, which is why the manifest copies ar, libbfd and libsframe out of the SDK. bsdtar reads the ar container directly, so all three can go. See registry/ai.cumora.Cumora/apply_extra.sh:

bsdtar -xOf code.deb 'data.tar*' | bsdtar --no-same-owner -xf - -C stage

--no-same-owner matters for system-wide installs, where apply_extra runs as root with every capability dropped.

5. Point the texts at FlatPark, not Flathub.

  • metainfo help → this repo's issues (or a README of yours), not flathub/com.visualstudio.code;
  • flatpak-warning.txt mentions flathub.org and flatpak install flathub …; the SDK extensions really do come from Flathub, but say which remote that is rather than presenting this as the Flathub build;
  • the description should say how this package differs from Flathub's (rule linked above). Your PR description is basically that text already.

Finally, please run the local checks from submitting (read-descriptor, audit-descriptor, check-apply-extra.sh, publish.sh --verify). CI hasn't run on this branch yet, and those checks will catch most of the above.

@francoism90

Copy link
Copy Markdown
Contributor Author

@jing2uo Thanks for your review! I applied the requested changes, please let me know if anything else is missing.

I did review it myself and it looks clean, but also used Claude Code to make some of these changes. This also means switching the runtime to Platform instead of SDK. This has some traits off, like no python/node. Please let me know if SDK is allowed (or should be used instead).

@jing2uo

jing2uo commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Thanks, the rest looks good now.

Yes, the SDK is allowed, and I'd go back to it. Runtimes come from Flathub and don't count against FlatPark's storage, and the Flathub package uses the SDK too. Please switch back to runtime: org.freedesktop.Sdk. Running on Platform breaks three things:

  • there's no git, so Source Control breaks;
  • SDK extensions don't mount at all, because the org.freedesktop.Sdk.Extension point exists only in the SDK. FLATPAK_ENABLE_SDK_EXT and the instructions in flatpak-warning.txt and the metainfo don't work;
  • the libtinfo.so.5 symlink dangles, because Platform has no unversioned libtinfo.so.

(For the record: Platform does have python3. Neither runtime has node; it comes from the node SDK extension.)

Please add a one-line comment in the manifest on why it's the SDK (git and compilers in the sandbox, SDK extensions), then revert the related lines in flatpak-warning.txt and the metainfo.

@francoism90

Copy link
Copy Markdown
Contributor Author

Done: back on org.freedesktop.Sdk with a one-line comment in the manifest (git and compilers, SDK extensions), and flatpak-warning.txt and the metainfo are reverted. check-apply-extra.sh and audit-descriptor.mjs pass.

@jing2uo jing2uo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for working through all of this so quickly. Approving. Here's the full review for the record:

Why it's listed: the Flathub package is third-party (not verified) and lags upstream by about a month (1.139.1 there, 1.144.0 here), so it qualifies under apps already on Flathub. The metainfo lists how this package differs.

What I checked:

  • Extra-data only: nothing is built from source. Microsoft's .deb and host-spawn's upstream static binaries are both extra-data, apply_extra.sh unpacks the .deb with bsdtar --no-same-owner and checks the layout it relies on, and dropping krb5 is noted in the manifest.
  • Updates: resolve-update.sh resolves Microsoft's commit-addressed, versioned .deb URLs from the update API and checks that x64 and arm64 agree on the version. host-spawn sits outside the managed block and is pinned by hand, as its comment says.
  • Permissions: each finish-arg has a reason. --filesystem=host, --device=all and --talk-name=org.freedesktop.Flatpak are declared in policy.dangerous_permissions, and packaging: declares host-command and seeded-config. read-descriptor passes, and audit-descriptor passes with only the expected warnings for the declared sandbox-escape permissions.
  • Runtime: the Sdk is the right choice here. It provides git, the compilers, the org.freedesktop.Sdk.Extension mount point and the libtinfo.so that the .so.5 link points to. Runtimes come from Flathub, so it costs FlatPark nothing.
  • Texts: help, the first-run note and the metainfo point at FlatPark, and say that SDK extensions and com.visualstudio.code.tool.* come from Flathub.

Nit, not blocking: flatpak-warning.txt still says ls /app/bin (bundled with this flatpak), but host-spawn now lives in /app/extra/bin. Fix it whenever convenient.

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