Рет қаралды 387
2024-10-26 13:45-14:25
Speaker: Pierre Penninckx
I personally believe NixOS to be the ultimate server management tool. But how to convince others? We must let them try NixOS!
Currently, the only way to try out NixOS is to go all-in. There's no way to get a feel for it by just replacing one small piece of an existing infrastructure. To ease and accelerate adoption of NixOS, this must change.
This talk goes over why module contracts is the essential and (yet!) missing piece that will help us spread adoption of NixOS.
Take the Nextcloud module. It is a wonderful module and I am one of its happy users. In a few options, it sets up a complicated beast of infrastructure in an elegant way. It even let's you choose which database you want to use!
There's a caveat, though. Like most of the modules in NixOS, it assumes ownership of its runtime dependencies. This makes it impossible to tell the module to use a database on another host, for example. One could modify the module to add this use case, but this quickly becomes not maintainable. It would make the module even bigger, even harder to test. Also, other modules could benefit from this nice feature and we can't just add this to all of them by copy pasting code around.
What if instead, the Nextcloud module did not own its runtime dependencies. What if the user, you, were in charge of spinning up a database and letting the Nextcloud module configure its database on that instance. Same for the Nextcloud cache, the reverse proxy, the backup service, etc. This dependency inversion is what module contracts is about.
This talk explores what a world with NixOS modules relying on contracts would look like. We'll see how one would configure a Nextcloud module using contracts. Also what it would look like to test it in their current infrastructure. We'll also go over other benefits of contracts. Finally, I'll showcase my project which explores contracts and what is already possible today and what the future plans are.