> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/electron-userland/electron-builder/llms.txt
> Use this file to discover all available pages before exploring further.

# Snap

> Configuration options for building Snap packages with electron-builder

The top-level `snap` key contains set of options instructing electron-builder on how it should build [Snap](http://snapcraft.io).

## Configuration

<ParamField path="base" type="string">
  A snap of type base to be used as the execution environment for this snap. Examples: `core`, `core18`, `core20`, `core22`.

  <Expandable title="default">
    `core20`
  </Expandable>
</ParamField>

<ParamField path="confinement" type="'devmode' | 'strict' | 'classic'">
  The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.

  <Expandable title="default">
    `strict`
  </Expandable>
</ParamField>

<ParamField path="environment" type="Record<string, string>">
  The custom environment. Defaults to `{"TMPDIR": "$XDG_RUNTIME_DIR"}`. If you set custom, it will be merged with default.
</ParamField>

<ParamField path="summary" type="string">
  The 78 character long summary. Defaults to [productName](/configuration#productName).
</ParamField>

<ParamField path="grade" type="'devel' | 'stable'">
  The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the "stable" or "candidate" channels) or "stable" (i.e. a stable release or release candidate, which can be released to all channels).

  <Expandable title="default">
    `stable`
  </Expandable>
</ParamField>

<ParamField path="assumes" type="string | string[]">
  The list of features that must be supported by the core in order for this snap to install.
</ParamField>

<ParamField path="buildPackages" type="string[]">
  The list of debian packages needs to be installed for building this snap.
</ParamField>

<ParamField path="stagePackages" type="string[]">
  The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.

  If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom package `foo` in addition to defaults.

  <Expandable title="default">
    `["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"]`
  </Expandable>
</ParamField>

<ParamField path="hooks" type="string">
  The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).

  <Expandable title="default">
    `build/snap-hooks`
  </Expandable>
</ParamField>

<ParamField path="plugs" type="Array<string | PlugDescriptor> | PlugDescriptor">
  The list of [plugs](https://snapcraft.io/docs/reference/interfaces).

  If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom plug `foo` in addition to defaults.

  Additional attributes can be specified using object instead of just name of plug:

  ```js theme={null}
  [
    {
      "browser-sandbox": {
        "interface": "browser-support",
        "allow-sandbox": true
      },
    },
    "another-simple-plug-name"
  ]
  ```

  <Expandable title="default">
    `["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]`
  </Expandable>
</ParamField>

<ParamField path="slots" type="Array<string | SlotDescriptor> | PlugDescriptor">
  The list of [slots](https://snapcraft.io/docs/reference/interfaces).

  Additional attributes can be specified using object instead of just name of slot:

  ```js theme={null}
  [
    {
      "mpris": {
        "name": "chromium"
      },
    }
  ]
  ```

  In case you want your application to be a compliant MPris player, you will need to define the mpris slot with "chromium" name.
  This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),
  and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement.
</ParamField>

<ParamField path="after" type="string[]">
  Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.

  If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom parts `foo` in addition to defaults.

  <Expandable title="default">
    `["desktop-gtk2"]`
  </Expandable>
</ParamField>

<ParamField path="useTemplateApp" type="boolean">
  Whether to use template snap. Defaults to `true` if `stagePackages` not specified.
</ParamField>

<ParamField path="autoStart" type="boolean">
  Whether or not the snap should automatically start on login.

  <Expandable title="default">
    `false`
  </Expandable>
</ParamField>

<ParamField path="layout" type="Record<string, Record<string, string>>">
  Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more.
</ParamField>

<ParamField path="appPartStage" type="string[]">
  Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.

  The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29).
</ParamField>

<ParamField path="title" type="string">
  An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).
</ParamField>

<ParamField path="compression" type="'xz' | 'lzo'">
  Sets the compression type for the snap. Can be xz, lzo, or null.
</ParamField>

<ParamField path="allowNativeWayland" type="boolean">
  Allow running the program with native wayland support with --ozone-platform=wayland.

  Disabled by default because of this issue in older Electron/Snap versions: [https://github.com/electron-userland/electron-builder/issues/4007](https://github.com/electron-userland/electron-builder/issues/4007)
</ParamField>

<ParamField path="synopsis" type="string">
  The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
</ParamField>

<ParamField path="description" type="string">
  As [description](/configuration#description) from application package.json, but allows you to specify different for Linux.
</ParamField>

<ParamField path="category" type="string">
  The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).
</ParamField>

<ParamField path="mimeTypes" type="string[]">
  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.
</ParamField>

<ParamField path="desktop" type="LinuxDesktopFile">
  The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)
</ParamField>

<ParamField path="executableArgs" type="string[]">
  The executable parameters. Pass to executableName
</ParamField>
