<aside> ⛔ This has been moved into Squarespace
</aside>
Language-specific package managers like Cargo, pip, npm are indispensable tools in software development because they quietly handle language-specific dependencies for you. But unfortunately they’re not so great at installing dependencies written in other languages (we call these external dependencies). One of the classic examples is Nokogiri, a widely used XML and HTML parser for Ruby, whose dependency on a C library called libxml2 has caused great consternation for Ruby devs over the years. More recently, external dependencies like OpenSSL and libiconv have produced headaches for Rust developers.
In the past, one semi-solution has been to list these external dependencies in the project’s documentation so that developers can install them on their own. Sometimes, projects go beyond that, providing detailed instructions on how developers on in different situations can install those dependencies. And occasionally, external dependencies aren’t mentioned and developers are on their own to provide them, which often means a lot of Googling and StackOverflowing.
Like many of you, we’ve grown weary of half-solutions. We want to be able to clone a project, cd
in, and have external dependencies quietly taken care of. And so we built a tool called Riff that provides a real solution to the problem of external dependencies. Today, we at Determinate Systems are thrilled to announce its initial release.
Riff is a tool that we built to help developers write software without having to wrangle dependencies or complicated configuration. It’s built to enable you to clone a project and get to work in seconds. It’s currently available for macOS and standard Linux systems.
Riff is powered by Nix, the purely functional language and package manager behind NixOS, Nixpkgs, and many other projects. But don’t worry: we built Riff to solve your problems without requiring you to use, understand, or care about Nix at all. Upon this initial release, Riff only supports Rust projects built with Cargo but we have plans to provide support for other languages, such as Go and the JavaScript ecosystem, in the future.
So let’s take a look at Riff in action. Prost is a popular Rust crate that provides a Protocol Buffers implementation for Rust. But on most systems, this is doomed to fail due to missing external dependencies:
git clone <https://github.com/tokio-rs/prost>
cd prost
cargo build
On Linux you get a linker
cc not found
error, while on macOS you get library not found for -liconv
errors. Annoying! Now let’s try it with Riff:
riff run cargo build
And it works! So what has happened here? Riff has:
Cargo.toml
,/nix/store
, and finallyThe cargo build
command here runs inside that Nix-built shell environment. In fact, you can enter that environment at any time and run arbitrary commands:
riff shell
# Enter the Riff shell
cargo run
cargo build
cargo clippy
exit
# Back to your standard shell
For more on Riff, including instructions for explicitly specifying external dependencies in your Cargo.toml
or using Riff with direnv, see the project README.
The first time we showed Riff to a user, they were quite surprised and even confused: how could it have been so straightforward? What on Earth quietly happened in the background? That's the energy we're going for with Riff: development environments that just work and require, at most, a teensy bit of configuration.