Nixos
Homepage, Nixos manual, package list, list of configuration options, wiki (currently pretty empty).
Nixos is an OS built on top of the Nix package manager. The originality of Nixos is its declarative approach to system configuration and its possibility to roll back after an upgrade.
To configure a Nixos machine, the user just has to modify a configuration file (/etc/nixos/configuration.nix, which can optionally be split in sub-files) and then call nixos-rebuild: the system configuration will change and reflect the demanded state.
This is different from traditional OSes in which many "imperative" commands have to be executed on top of changing the configuration (e.g. apt install to install packages).
Another advantage is that the configuration file(s) can by synchronized with versioning tools (such as git), so that configurations are repeatable.
Installation
See the Nixos manual.
From a nixos ISO
- Download the ISO from the download page.
- Boot on the ISO
- Partition the system: Nixos currently does not have any automatic installer that does partitioning, so you must set up partitions, filesystems, LVM, RAID, etc by hand. The Nixos ISO includes tools for doing so (e.g. gParted, fdisk, lvm, ...)
- Mount the partitions on
/mntand subdirectories. Follow the Nixos manual to know how to do so nixos-generate-config --root /mnt- Check
/mnt/etc/nixos/hardware-configuration.nix: it is automatically generated and should be correct for your system, but it is worth checking it. - Edit
/mnt/etc/nixos/configuration.nixto what you want.- If installing on a remote machine, do not forget to enable ssh (by setting
services.sshd.enable = true;) and create a user with a password so that it can connect via ssh
- If installing on a remote machine, do not forget to enable ssh (by setting
nixos-installrebootand hope for the best
From an existing Linux system
Nixos can be installed from a running Linux system: it replaces the boot loader and moves all the content of the old file system into /old-root, so that next time you boot you have a Nixos OS.
See https://nixos.org/nixos/manual/index.html#sec-installing-from-other-distro
The installation steps are, roughly, the following:
- Install tools:
curl,mkpasswd,sudo - Check your current network configuration (especially on a remote machine), e.g. by running
ip addr,ip routeandcat /etc/resolv.conf - Download and install the Nix package manager
- Use the Nix package manager to install
nixos-generate-configandnixos-install nixos-generate-config --root /- Check
/etc/nixos/hardware-configuration.nix: it is automatically generated and should be correct for your system, but it is worth checking it. - Edit
/etc/nixos/configuration.nixto what you want.- If installing on a remote machine, do not forget to enable ssh (by setting
services.sshd.enable = true;) and create a user with a password so that it can connect via ssh
- If installing on a remote machine, do not forget to enable ssh (by setting
- Build the Nixos configuration
- Create
/etc/NIXOS(empty file) and/etc/NIXOS_LUSTRATE(one line per folder that you wish to keep. At least one line containing/etc/nixos) switch-to-configuration bootand hope for the best