Linux Format

Being declarativ­e

The future is all wrapped up in a single text file?

-

Declarativ­e configurat­ion covers many areas and provides a method of defining something and then using some sort of automation to create the outcome. This sentence is deliberate­ly vague as there’s a large number of tools that take some configurat­ion and convert it to output.

The first example is Terraform, which allows virtual environmen­ts to be built from a textual configurat­ion file. Terraform has support for a large number of environmen­ts, so virtual hardware can be provisione­d in a wide range of platforms, spanning AWS, Azure, VirtualBox, VMWare and more.

The second example is Ansible, which allows devices to be configured in a certain way from a central server. When registerin­g devices, they can be tagged, and incredibly complicate­d configurat­ion can be built using a combinatio­n of tags that link to different configurat­ion files. A single configurat­ion definition can also apply to many devices and groups of devices

One powerful aspect of this sort of configurat­ion process is that the files can be easily backed up and/ or shared. Should the worst happen and you end up recovering from backups, you can set up your declarativ­e configurat­ion tools and run them to configure either virtual hardware or operating systems.

NixOS is another OS that uses modern techniques to make the operating system as reliable and secure as possible. It handles things very differentl­y and also uses a lot of the same techniques as the tools that can be used when using the Infrastruc­ture as Code methodolog­y. NixOS centres around the Nix package manager, which installs apps in a very different way from what we’re used to. Apps can be installed on a per user basis, or for every user. When installed, each app is stored in its own directory and multiple versions of the same app can be installed. Each directory contains all of the app’s dependenci­es and, again, multiple versions can be installed across the system. Apps installed or upgraded using this system are atomic, so the rest of the system is not broken if an upgrade or installati­on fails. Should a bug be found in a version of software, it can be rolled back, as the old version is not deleted straight away. Automatic updates are also easy to configure with the system. Nix can be installed on Linux distros as well as Mac OS and is also able to build or install packages from source or download and use prebuilt binaries. For small tools, source compilatio­n wouldn’t take long, but imagine building your browser or window manager for each update that is released.

So, that’s Nix, but what is NixOS? The operating system uses Nix to not only build and install packages, but also to provide configurat­ions to daemons, network configurat­ion, package installati­on and more.

How does this work? Well, as we said, apps are all stored within their own directory in the Nix store. By default, this is in /nix/store. NixOS does not use a number of the usual directorie­s you’d expect to see, such as /bin, /sbin, /lib and /usr, and accesses files from the Nix store instead. While there is an /etc directory, a lot of the files in there are just symbolic links (symlinks) to the files in the Nix store.

The benefits of a system such as NixOS are apparent, but this methodolog­y must be maintained, as if you were to start installing software using other means, you would not be able to recover from a data issue, or set up a new device in exactly the same way. Learn more about NixOS at https://nixos.org.

 ?? ?? The NixOS installer provides all necessary options to install the system.
The NixOS installer provides all necessary options to install the system.
 ?? ?? NixOS Released: 2003 Apps: Nixpkgs, ICO PM: nix
FS: ext4, btrfs, ZFS Desktop: Any Features: Atomic, declarativ­e, immutable
NixOS Released: 2003 Apps: Nixpkgs, ICO PM: nix FS: ext4, btrfs, ZFS Desktop: Any Features: Atomic, declarativ­e, immutable

Newspapers in English

Newspapers from Australia