-
Notifications
You must be signed in to change notification settings - Fork 35
NixOS
NixOS is a Linux distro tightly integrated with the Nix package manager. It is known for its declarative configuration, reproducibility, and powerful package management capabilities. It allows us to specify the operating system and the configuration of installed services and dependencies within this repository.
The key features NixOS provides to us include:
- Ship the exact same software to our own, and to costumer's machines.
- Handles the entire OS configuration, from kernel parameters to the wallpaper installed.
- If things break, simple roll back to any other installed version and your ready to go again.
- Well defined update process, that cannot fail.
- We can boot any version without much hassle. Makes it easy to boot into unfinished work; test things and then go back.
The most important NixOS features in more detail.
NixOS is build with the Nix package manager.
The desired operating systems' state is defined inside a configuration.nix file in a purely declarative way.
Thus NixOS can guaranty that the same configuration will result in the exact same system.
Importantly, it does not depend on when QiTech Control is installed or what was previously installed on the computer, NixOS or not.
Next to the front- end back-end code, we also manager the Nix configuration inside this repository. Thus, system configuration, installed programs, program defaults and of course QiTech Control will always be the same for each version. Conflicting software versions or a system misconfigured are therefore, in a sense, impossible.
Every commit in this repository can be understood as a separate Nix configuration that one can boot into. We use release tags to mark commits as stable versions. If we, or our costumers, want to use a specific version of QiTech Control, they simply have to specify the commit hash and let the NixOS take care of the update.
However, the Nix package manager does not simply overwrite the current system during an update. Instead, the new version is build and stored next to the current (and potentially also older) versions. Only when a version was built successfully, is it marked as bootable and can be selected during system startup. Doing so means that updates cannot break the system. Additionally to the new version showing up at boot, older versions can also be booted into. If the user decides that they are not satisfied with the newest version, they can easily rollback into an older version and use that.
By letting NixOS boot our feature branches, we can test each new feature in isolation on our hardware before merging it into the master branch. This creates development-test cycle where we can swiftly switch back and forth between different things we want to test. At no point do we have to manually revert our changes to get our production lines back into a ready-to-use state.
- The user selects a version (commit/branch/tag) of the software they want to install
- The repo is cloned to the local machine
- Information like the commit hash, branch, tag, timestamp etc. is passed to the nix build process as environment variables
QITECH_OS... - The
nixos-switchcommand is run. After rebuilding & compiling the software the system reboots.- The nixos-switch command does the following:
- The system is built with the new configuration
- The system is switched to the new configuration
- The system is marked as "installed" with the new version
- The system is set to boot into the new version
- The computer automatically reboots into the new version of the OS + software.
QiTech Control | GitHub | Video Demo | Open Source Framework for Industrial Control