A NixOS configuration repository had six bash scripts: deploying to a machine, running the VM tests, upgrading, pushing a firewall to the router, backing up the router, and a secret scanner that keeps plaintext secrets out of a public repository. They were ported to Scala 3, one program with a subcommand per script (about 3,400 lines today, now with a few more scripts). The code was then made stricter in stages:
- Effects in
IO(cats-effect), with expected failures as values:type ScriptT[A] = EitherT[IO, ScriptError, A], whereScriptErroris