Computing: Computer Administration

Some tips concerning NixOS.

NixOS is an independent GNU/Linux distribution developed in the Netherlands. Its particularity is that the entire operating system, including the kernel, applications, system packages and configuration files, are built by the Nix package manager. Nix stores all packages in isolation from each other. There are no /bin, /sbin, /lib or /usr directories and all packages are kept in /nix/store instead. As a result, some common tasks have to be done somewhat differently as on other Linux systems. This short text might be helpful, if you have NixOS related questions or if you encounter problems when installing or using it. The system that I actually tried out is NixOS 22.11 Raccoon with Gnome desktop. The tips given here should apply to other releases, too.

1. System hanging during installation.

When I first tried to install NixOS 22.11, all went well until the phase, where the setup program copies the files from the installation media to the harddisk. Copy stopped (at 46% of the installation process done) and the system became unresponsive.

System hanging during installation of NixOS 22.11 onto harddisk

I'm not sure about the reason for this, but it may be that it's a memory problem. 2 GB of RAM seem not to be enough to successfully install the OS. After I had changed the configuration of my virtual machine, giving it 3 GB of RAM, the installation succeeded without any problems.

2. System update.

As I said above, package management in NixOS is done in an innovative way. If their approach is as good, or better than the classic Linux way, no idea. It is somewhat more complex, I would say. Here just the commands that you have to run in order to update all packages to their actual versions (unfortunately, I don't find back the webpage, where I took this information from...); for details, please have a look at the NixOS manual.

You should first update the software list by reading down the current versions of all packages available. This is done using the command:
    sudo nix-channel –update

Software on NixOS may be installed in several ways, and so there are several ways to update the packages:

3. Software installation.

The easiest way to install new packages on NixOS is to use nix-env. The interesting thing here is that you may install not only the latest version, but install several versions of a given package side by side. For details about this really special feature, you may want to have a look at How to use NixOS Package Manager?

To retrieve a list of all the available packages (as example, the web browser firefox), use the command:
    nix-env -qa 'firefox.*'

To install a given package (here again for firefox), use the command:
    nix-env -i firefox

4. Accessing NTFS partitions.

One of my USB sticks is formatted with the NTFS filesystem. This may appear unusual, but has one advantage: the possibility to store big files, i.e. files of more than 4 GB in size. When trying to access the flush drive on NixOS, I git the error message that NTFS is not configured in the kernel.

Error when trying to access an NTFS formatted flush drive on NixOS 22.11

NixOS uses NTFS-3G to access NTFS partitions. You can install the package and enable NTFS support in the NixOS configuration. You can open configuration.nix with root privileges (that will allow you to save the file to its original location after having changed it) by opening a terminal and typing (nano being the NixOS text editor):
    sudo nano /etc/nixos/configuration.nix
Add the following line to the configuration file:
    boot.supportedFilesystems = [ "ntfs" ];

Adding NTFS support in configuration.nix

But, attention, this is not enough! To make the changes permanent, it's mandatory to run
    sudo nixos-rebuild switch

5. Changing the hostname.

The hostname is not asked during system installation (it is automatically set to "nixos") and the usual Linux commands to change it are not supported on NixOS. However, it's quite easy to change it: just a setting in configuration.nix to change.

You can open configuration.nix with root privileges (that will allow you to save the file to its original location after having changed it) by opening a terminal and typing (nano being the NixOS text editor):
    sudo nano /etc/nixos/configuration.nix
Search for the key networking.hostName and set the key value to the name that you want to give to your computer.

Changing the NixOS hostname in configuration.nix

To make the changes permanent, run
    sudo nixos-rebuild switch


If you find this text helpful, please, support me and this website by signing my guestbook.