All successful and productive enterprises prefer a professional team performing their job well, whether software development, quality assurance, or operation. It is precisely the case with the NIX language, which distinguishes itself by a high level of integration, which creates the right balance between stability and flexibility. NIX programming has strong benefits for both backend and DevOps solutions; it is one of the best in the arsenal of SRE and DevOps experts for qualitative services.
The introduction of Nix as a collection of tools and systems that together form a highly reproducible build system and can help you increase delivery capabilities and ensure a high-quality level of software reliablility.
What does the Nix DevOps toolkit solve?
Nix solves several problems, but which ones you care about depends on your field of activity.
If you are in development, Nix gives you a declarative and reproducible way to manage your system, which is essential if you plan to maintain your changes. If you break something, you can safely update and fix packages by using rollback.
For project managers, Nix solves the problem of maintaining a text list of libraries in your README for installation by co-developers. You can use Nix+Direnv, and they will automatically get all the libraries on which the project depends. So, if you go back to the old commit, it will just work, or if you fetch master and new dependencies appear, it will also just work.
If you are part of DevOps in a company, you get all of the above advantages for faster implementation. You can also create rarely and intentionally layered docker images for more minor updates. Besides, you can reliably cache packages on your build server, for example, so as not to rebuild/download post-install libraries after installation.
You also avoid YAML/JSON confusion when mapping fields to functions in a language like Go. Nix is a programming language, so you can do things in it to avoid configuration patterns. Although Dhall, IMO, is better suited here, Nix is still better than YAML/JSON.
NixOS, as a part of the DevOps toolkit, also offers several advantages to its users:
- You won’t break it by “sudo make install” of a random package.
- NixOS doesn’t come to a bad state when you have to reinstall it to clean things up. Many users say they are running the same instants of this OS on different generations of laptops without any noticeable difference from a “fresh” OS.
- There is a built-in rollback mechanism (mentioned earlier). Even if you make a failed update, you can just download the old version of the system without doing anything special. All that is needed is to run an explicit garbage collection to clean up the old configuration.
Despite being super stable, NixOS is also quite flexible, and you can easily mix a stable base with unstable parts:
- You can run either a stable or unstable channel, both of which are released every two years.
- You can run a stable channel and select specific packages from an unstable channel without fear that you will end up with DLL (Dynamic-link library) problems.
- If an unstable channel is not enough, it is relatively easy to completely redefine certain packages, for example, versions compiled from an unreleased master branch. Again, without fear of infecting the system with different versions of libraries or breaking it in other ways. – It’s pretty easy to send patches to nixpkgs to update existing programs or add new ones.
Nix language is a relatively simple pure functional language with dynamic typing specializing in creating packages. On the other hand, Nix as a package manager is interesting and unique.
Conclusion
All in all, Nix can be used to create and quickly deploy a variety of services and manage development environments. Nowadays, many developers use Nix mainly because it provides fast, atomic deployment and instant rollback. Having a domain-specific programming language at your disposal and a collection of packages supported by an active community is a huge benefit. We recommend that everyone tries Nix and its DevOps toolkit to see what it is like, if not anything else.