Iota is a small editor for your terminal, with support for emacs hotkeys or vi-style commands, syntax highlighting, and easily hackable, written in Rust… now wouldn’t it be awesome if I could install it easily as a snap? So I figured I’d contribute a snapcraft YAML in my lunch break. Here’s how I did it.
Head to https://github.com/gchp/iota and hit Fork on the top right. Let GitHub work its magic. Once it’s done I can checkout the code.
git clone email@example.com:kalikiana/iota.git cd iota snapcraft init
At this stage I’ve got a local copy of iota and a
snap/snapcraft.yaml that was automatically created for me. Some editing is needed.
name: iota summary: Iota is a terminal-based text-editor written in Rust description: | 100% open source highly extensible/customisable/scriptable fast & efficient - designed with modern hardware in mind cross platform - it should work anywhere developer friendly - it should just "get out of the way" Rust tooling integration
The fields name, summary and description are pretty self-explanatory, especially given the template
snapcraft init creates. I just picked some wording from iota’s README.md.
version: git grade: devel confinement: classic
version: git here because it just picks up the tag or commit hash, and it’s good enough for an unstable build anyway.
confinement: classic is much more interesting here because this is an editor, and I want to be able to edit all the files on my system.
confinement: strict wouldn’t allow that as it restricts access to specific folders only used by the snap itself.
apps: iota: command: bin/iota
Note how I’m specifying
bin here explicitly. Classic snaps don’t get any path magic unlike their strict counterparts.
parts: iota: plugin: rust rust-channel: nightly
Now as for the actual build instructions I don’t really have to do much. iota specifies all its dependencies in its
Cargo.toml so no build-packages or stage-packages are necessary. The only thing I need to specify here is the nightly channel since iota requires unstable rust features.
This takes a while as rustup downloads the toolchain and crates needed behind the scenes. High time to grab that lunch my break is meant for.
Fast-forward, I’m installing the result of that build.
snapcraft install --dangerous --classic iota_0+git.67643b3_amd64.snap
Now I can use iota as my editor!
Last but not least, after some testing:
git add snap/snapcraft.yaml git commit -p -v git checkout -B snapcraft git push origin snapcraft
Finally, I’m opening a pull request on GitHub.