As I read throughout the Nix documentation and pills, I keep thinking about how Tuist could leverage its functional and deterministic way of setting environments to improve the experience of developing apps for Apple platforms.
Deterministic environments running “tuist up”
The first idea that popped in my mind is using it from “tuist up” to set up the environment rather than delegating the installation to Homebrew. Homebrew is widely used in the community, but it does a poor at ensuring environments are reproducible and that installations don’t break when transitive dependencies are updates (e.g. macOS upgrades). Tuist up could install Nix, and use it to install packages defined in the
Setup.swift file. The definition for the packages would be in our own repository of definitions, some of which could be contributed upstream to the official packages repository. It’d contain the definition for packages like Carthage, Swiflint, or SwiftGen. Thanks to this, all the developers will be using the same version of the tools and therefore getting consistent results when working on their projects. If we go down this path, we could deprecate Homebrew as a valid up task and and document how to contribute adding more packages to Tuist’s channel.
tuist-env delegating to Nix
The second idea is using Nix to manage installations of Tuist.
This is something that we are currently doing implicitly with
tuist-env. When users run
tuist, they are actually running
tuist-env, which takes care of installing and calling the right version of Tuist. With the adoption of Nix we could take a different approach where we’d activate the right version of Tuist when cd’ing into directories.
tuist-env would just be a user-friendly interface to Tuist.
tuist-env has served its purpose well, I’ve never been fully convinced of its implicit approach being a good idea. I implemented it because I didn’t want the user-experience to be worsened by using Homebrew, but after using Nix, I really feel it’s time to delegate that task and rather focus on Tuist.
I’m curious about your thoughts on this and if you think those are sensible ideas that we could adopt. As always, this is with the aim of making things deterministic and simple for the users.