Skip to main content

Interface: SnapOptions

Flat snap options. Used via the snap key in your build config.

Deprecated

Prefer the snapcraft key with an explicit base field (e.g. { "snapcraft": { "base": "core24", "core24": { ... } } }). The flat snap interface is maintained for backward compatibility and targets core22 and older snap bases only.

Fields inherited from CommonLinuxOptions (e.g. description, category, mimeTypes, executableArgs) are automatically populated from linux.* configuration and do not need to be repeated here. Per-core values take precedence when both are set.

Extends

Properties

after?

readonly optional after?: string[] | null

Names of snapcraft parts that must be built before the app part. Defaults to ["desktop-gtk2"].

Use "default" to keep the default and add extras: ["default", "my-helper-part"].


allowNativeWayland?

readonly optional allowNativeWayland?: boolean | null

Allow the snap to run with native Wayland support (--ozone-platform=wayland). Defaults to false for Electron < 38 (legacy behaviour); true for Electron ≥ 38. Set explicitly to override the version-based default.


appPartStage?

readonly optional appPartStage?: string[] | null

Filesets controlling which files from the app part are staged into the snap. Supports individual files, directories, globs, globstars, and exclusions (prefix !). See Snapcraft filesets. When not set, the snap template's default stage list is used for legacy bases (core18/core20/core22).


artifactName?

readonly optional artifactName?: string | null

The artifact file name template.

Inherited from

TargetSpecificOptions.artifactName


assumes?

readonly optional assumes?: string | string[] | null

Snapd features that must be present on the host before the snap can be installed.


autoStart?

readonly optional autoStart?: boolean

Whether the snap should automatically start on login.

Default

false

base?

readonly optional base?: string | null

The snap base to use as the execution environment. Examples: core18, core20, core22.

For new projects, use the snapcraft key with base: "core24" instead of this legacy interface.


buildPackages?

readonly optional buildPackages?: string[] | null

Debian packages required at build time (installed inside the build environment).


category?

readonly optional category?: string | null

The application category.

Inherited from

CommonLinuxOptions.category


compression?

readonly optional compression?: "xz" | "lzo" | null

Compression algorithm for the snap SquashFS image.

  • xz — smaller file, slower decompression (good for distribution).
  • lzo — larger file, faster decompression (good for development iteration). Omit to use snapcraft's default (xz).

When not set, linux.compression is mapped automatically: "store""lzo", "maximum""xz", "normal" → snapcraft default. Explicitly setting this field always overrides the mapped value.


confinement?

readonly optional confinement?: "devmode" | "strict" | "classic" | null

The type of snap confinement.

  • strict — recommended; the snap runs in a fully isolated sandbox.
  • devmode — sandbox violations are logged but not enforced; for development only.
  • classic — no confinement; equivalent to a traditionally packaged application. Requires Snap Store approval before publishing.

Default

strict

description?

readonly optional description?: string | null

As description from application package.json, but allows you to specify different for Linux.

Inherited from

CommonLinuxOptions.description


desktop?

readonly optional desktop?: LinuxDesktopFile | null

The Desktop file

Inherited from

CommonLinuxOptions.desktop


environment?

readonly optional environment?: {[key: string]: string; } | null

Environment variables injected into the snap's runtime environment. Merged with the electron-builder default { TMPDIR: "$XDG_RUNTIME_DIR" }. User-supplied values take precedence.


executableArgs?

readonly optional executableArgs?: string[] | null

The executable parameters. Pass to executableName

Inherited from

CommonLinuxOptions.executableArgs


grade?

readonly optional grade?: "devel" | "stable" | null

The quality grade of the snap.

  • stable — suitable for all channels, including stable and candidate.
  • devel — development snapshot; cannot be promoted to stable or candidate.

Default

stable

hooks?

readonly optional hooks?: string | null

Directory containing snap hooks, relative to the build resources directory (build/).

Default

build/snap-hooks

layout?

readonly optional layout?: {[key: string]: object; } | null

Snap layouts — bind-mount or symlink host paths into the snap's namespace, making libraries or config at /usr, /var, /etc, etc. accessible inside the confined environment.


mimeTypes?

readonly optional mimeTypes?: string[] | null

The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.

Inherited from

CommonLinuxOptions.mimeTypes


plugs?

readonly optional plugs?: PlugDescriptor | (string | PlugDescriptor)[] | null

Plugs (consumed interfaces) to declare for the app entry point. Defaults to ["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"].

Use "default" in the list to keep the defaults and append extras: ["default", "camera"] adds camera to the standard set.

To configure plug attributes (e.g. allow-sandbox for Chromium's internal sandbox), use a descriptor object:

[
{ "browser-sandbox": { "interface": "browser-support", "allow-sandbox": true } },
"another-simple-plug-name"
]

publish?

optional publish?: Publish

Inherited from

TargetSpecificOptions.publish


slots?

readonly optional slots?: SlotDescriptor | (string | SlotDescriptor)[] | null

Slots (provided interfaces) to declare for the app.

To expose an MPRIS player under the Chromium bus name (required for strict confinement):

[{ "mpris": { "name": "chromium" } }]

Chromium hard-codes the bus name chromium, so the slot name must match for snapd to allow it.


stagePackages?

readonly optional stagePackages?: string[] | null

Ubuntu packages to stage alongside the app (equivalent to depends for deb). Defaults to ["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"].

Use the "default" keyword to extend the default list: ["default", "my-extra-lib"] appends my-extra-lib to the defaults.


summary?

readonly optional summary?: string | null

A short summary of the snap (max 78 characters). Defaults to productName.


synopsis?

readonly optional synopsis?: string | null

The short description.

Inherited from

CommonLinuxOptions.synopsis


title?

readonly optional title?: string | null

Display title for the snap (may contain uppercase letters and spaces). Defaults to productName. See snap format.


useTemplateApp?

readonly optional useTemplateApp?: boolean

Whether to use the pre-built Electron snap template for faster builds. When true, electron-builder delegates snap assembly to the upstream Electron snap template rather than running a full snapcraft build, significantly reducing build time. Defaults to true when stagePackages is not customised. Only applicable to x64 and armv7l builds.