How to create custom interface

There isn’t a mechanism to create a custom interface for only your system. Currently interfaces are encoded into snapd such that they are either implicitly provided by the core snap (in which case they may exist only on core, only on classic, or on both. An example is ‘network’) or are exposed via a providing slot implementation (eg, when the mir-kiosk snap is installed, the ‘mir’ interface is available to plug).

If you need additional access, you can submit a PR for snapd against an existing interface, create a new implicit interface or create a slot interface for access to your snap. @zyga-snapd has documentation on this: http://www.zygoon.pl/2016/08/creating-your-first-snappy-interface.html, but quite a few things have changed since he wrote that, so it might be simpler to simply copy existing interfaces/builtin/<interface>.go and interfaces/builtin/<interface>_test.go files to something appropriately named, modify them and make sure the tests pass (see HACKING.md). Then you can build snapd and test it on your target device (also see HACKING.md).

2 Likes