However, I’ve encountered two major issues that I can’t seem to resolve:
I need to copy files to /var/witch_craft/, but I’m unsure how to do this within the Snapcraft build.
Although the snap builds and installs (the snap file is around 1GB, by the way), it won’t execute.
I found a related issue on the Snapcraft forum: Snap run app cannot find app, where Alan_g mentions: “That error indicates the snap has been packaged incorrectly. That needs to be fixed by the packager.” I believe this is likely the problem, but I’m not sure what I’ve done wrong in the packaging process.
During the snap build this isn’t reasonable. Even if you were to copy files to /var/... they would be on the build host/VM, and not included in the snap. They need to be in $CRAFT_PRIME/var/....
At runtime it is best if you can configure the application to find these files in $SNAP/var/.... But that isn’t always possible. The next option is to use a layouts section in the snapcraft recipe to bind mount $SNAP/var/... as /var/....
I found the solution, and it’s much simpler than I thought. However, I need to point out that the Snap documentation is lacking and confusing, more than it should be.