Before you can build a snap, you need to know a few attributes about your application.
These attributes ensure a snap can be built and, via a 3-point checklist outlined below, help with the construction of the application’s snapcraft.yaml.
There are currently a few types of project that are unsuitable for snaps:
- media content providers (except themes)
- applications built specifically for ARMv6
- applications that need a binary in
Before going any further, make sure your project builds and runs from a clean environment. This will help clarify any wayward dependencies or specific installation requirement that may have been forgotten in an old build tree.
Creating a checklist
A snap’s requirements reflect those of the application itself.
If you’re developer working on the application, or a technical user familiar with a project, a snap’s requirements won’t contain any surprises; they’re what you need to build your application.
Spit roughly into their relevance, and the order you should tackle each requirement, here’s what you need to know:
1. Language/Framework/Build system (mandatory)
This the foundation of your snap. It defines how your snap is built and is often an extension of the programming language you’re using. Examples include Python applications using PyPI and Go projects using go get, but also build systems like cmake and platforms like Electron.
Applications can be built using a single part with a single plugin, or from multiple parts and multiple plugins, depending on their complexity.
2. Toolkits and desktop support (optional)
There are recipes for incorporating many popular toolkits into your snap, either by pasting pre-configured snippets into your snap’s snapcraft.yaml, or by using a new Snapcraft feature called Extensions.
See Snapcraft Desktop Helpers for example parts with toolkit and desktop integration.
3. System integration (optional)
Your application may have requirements of the system its running on, and these requirements are typically satisfied by configuring one or more interfaces.
These requirements may be as simple as access to a user’s home directory, sound playback and recording via PulseAudio and desktop interfaces. But they can equally include process management or memory access.