NixOS 14.04 Review

Oct. 30, 2014, 9 p.m.

NixOS is an independent Linux distribution with a completely unique and innovative approach to package management, system configuration, configuration rollback, and prevention of breakage due to dependency issues -- even combining all of these functions into a single configuration file activated with one command. This system offers the obvious benefits intended by the developers, but some users may also appreciate its power in customizing the system down to the dependencies and options built into installed packages, similar to a Gentoo system -- but all sepecified in the single configuration file. If you can live with a nonstandard directory structure, use of gummiboot instead of GRUB2, and a learning curve steeper than other Linux distributions, you may like and use it for its advanced features, but this is not for beginners and/or the unmotivated.

Review

The fundamental characteristic of NixOS is the single configuration file that controls the entire configuration of the system including what packages are available in the configured system i.e. what packages are installed. The developers call this characteristic a "declarative approach to configuration management: you write a specification of the desired configuration of your system in NixOS’s modular language, and NixOS takes care of making it happen."

This means that you can specify every detail of the installed system, execute a single command, and whatever is specified in the configuration file is put into effect. Some elements that can be specified in the configuration file besides packages that should be available on the system are whether the X11 system should be used, whether to enable networking, the desktop environment to be used, and whether networking is enabled. Everything else about the system can be specified in this file also.

The other unique feature of this distribution is that each build of the system configuration is saved and available to boot into until purged from the system. This allows rolling back to any one of the saved configurations if still available -- a feature the developers reffer to as "atomic upgrades and rollbacks". They say that "it's always safe to try an upgrade or configuration change: if things go wrong, you can always roll back to the previous configuration."

There are also other innovative features that would be of interest to administrators that need to deploy a large number of systems with similar features to physical and virtual machines on site and in the cloud, but those features are not covered here.

NixOS's KDE 4.12.4 desktop after some customization

The power of these features is provided by the Nix expressions language used to construct the configuration file and to build packages on the system. Two manuals are provided that thoroughly cover Nix -- one that covers the necessary details of Nix expressions to configure a system including the two methods of installing packages which are available in the Nix repositories or channels, and the several methods of building and installing packages not available in the channels or building and installing custom packages. This manual also lists all of the available attributes for the configuration explaining the purpose of the attribute, and default and allowed values of the attributes. The other manual delves into the Nix expressions in more detail to provide more information on building packages. A third manual is available for those who will use NixOS's advanced deployment features.

I appreciate all of these unique and innovative features. I can also see that in a sense it is easier to maintain than a traditional Linux system, but there are some possible drawbacks to this distribution -- depending on a user's point of view, not in technical accomplishment or documentation but in the practicality of using this OS for most users and what seems to me a flaw in the approach to managing and making the choices regarding the building of packages in the repositores.

NixOS during a nixos-rebuild switch operation
Note the collision error discussed later.

My use case may illustrate one of the drawbacks of NixOS-- the necessity of building many custom packages: I need the typical software that everybody uses, like a browser -- which I had some issues with, which I discuss later -- and some packages specific to the work I want to get done on a computer. This requires a complete texlive distribution so I don't have to track down specific style or class files and LyX. A complete working texive system is available on all of the other Linuxs I have tried but the expression available on the NixOS channel did not work. I then installed all of the available components of texlive and then included a customised build of the latest LyX source in my system packages, a process made very simple thanks to the excellent documentation and the power of the nix expressions language. This resulted in a partially working LyX distribution where some modules were not available -- most likely because all components of texlive were not available, and where publisher class files that are normally available in other distributions were not available. I solved the second issue by manually adding the class file to the directory where the document I was working on was saved. The first issue is also solvable by building a custom full texlive distribution and adding this to my system packages; this however would require becoming familiar with the texlive buiding process.

One of the parts of this process to get a system that suits my needs was building a custom LyX package. The reason for this was that the package title in the package search listed version 2.0.7 wheras the source was 2.1.1, a quibble, and the choices made in building LyX by the maintainers. For example, the hunspell spellchecker is included in the latest build, but in the previous version of this package, enchant was the spellchecker included in the build. Other build input differences between the two versions seem arbitrary, and may not consider benefitting as many users as possible, which is a guiding principle of the other highly customizable system that I am aware of -- Gentoo. Building the package myself would allow me to have all three commonly available spellcheckers and include anything else I wanted that would enhance LyX.

The packageing issue may not be a drawback for some users, who may be the appropriate audience for NixOS. These users may not mind having to build a custom package and actually want to control every aspect of a package, which NixOS makes it easy to do -- perhaps more easily and more reliably than Gentoo. For me this is appealing but not as a primary system. But for other types of users, is it practical to go through all this when, for example, one command could install a full texlive and LyX with or without recommended and suggested packages.

Another negative may be the nonstandard directory structure. Because of this, common knowledge of system configuration and problem solving will not apply, for example the backlight control issue I had which I needed to solve for good battery life and the suspend to disk feature that is not available, a problem which not as pressing. Some settings that are normally handled with many options by KDE's System Settings can't be managed using this tool but only through attributes in the Nix configuration file that in some cases do not allow for as much flexibility.

Also is the use of gummiboot instead of GRUB2 for EFI systems. At one point I had four Linux distributions and Windows multi-booting using any one of the four GRUB installations. It was easy to choose between any of the installed systems; now if gummiboot is at the top of the list of EFI boot managers, the choice is only Windows or NixOS and have to go through a longer process if I want another Linux to boot.

The largest issue I have with NixOS is the collisions that can occur between packages during the building of the configuration with the nixos-rebuild switch command. Appendix B-1 of Nix User's Guide, the documentation of the package manager -- which can be installed separately in other OSes, addresses collisions in the context of package management on a per-user basis. I have seen instances of collisions when building the system wide configuration. Based on the explanation in the Nix User's Guide, in the case of the system-wide configuration, I think the same thing is happening except that the collisions are between two packages included by NixOS to satisfy dependencies of packages included in the specified configuration, and not in packages explicitly chosen by the user

Quick Facts

Download

A minimal installation iso and a live iso with the KDE desktop are available in both 64 bit and 32 bit versions from the NixOS download page.

Desktop Environments

The KDE is included by default in the live iso. Other desktops are available by installing from within an installed NixOS with KDE or from the minimal install which does not include X11, which means you would have to install X11 and whatever else is necessary and then install your desired desktop environment. A search of the NixOS package search page shows that Xfce, Cinnamon, and Gnome are available.

Package Management and Included Software

A graphical package manager is not available. Although packages can be searched on the NixOS Packages page, where detailed information on packages is available, including the expression used to build the packages and the history. These two pieces of information, along with the documentation, can provide clues to how you can build a custom version of the package and what options to include in your custom version.

There are two methods of installing packages; the preferred of the two methods is to include a package in the configuration by assigning package name values to the "environment.systemPackages" attribute which makes the package a part of the declarative system configuration, the second is a command line that works very similarly to other Linux distributions, but this method does not make the package available system wide. Details of the package management are in a section below.

Enabling KDE in the standard configuration file generated at installation does not include any software except the Konqueror file/web browser. It doesn't even include the very useful KDE Network Management tools but with only setting the networking.wireless.enable attribute to true only gives you wpa_supplicant. Suggestions on packages to include are in a section below.

Ease of Use or Challenge Level

It is relatively straightforward to get a working installation quickly. However, there is no graphical installer, even with the live KDE iso so the installation is done using a series of command line actions in a terminal. Some may find this challenging, but the actual process is short and simple with only a few commands accomplishing the installation. The NixOS manual is also very helpful, although without some adjustmnets to the process outlined you will end up with an installation you may not want, like an installation without a separate home partition.

Besides the installation, this distribution is more difficult to use compared to the average distribution, but only in some details. For example, by default the KDE networking manager is not installed by default, so initially, you will have to use wpa_supplicant to connect to by adding wireless networks you want to connect to to the wpa_supplicant configuration file. It took some searching to find the right network setting to remove from the configuration file and the right setting to add in its place in order to enable KDE network manager.

You may also run into a situation where you don't want a package as built in the NixOS 'store' or repository, so you may need to learn how to specify a custom build of the package in the Nix configuration file. Learning this is the only difficult thing about this, the actual implementation is actually easy and well documented in the NixOS manual.

So, although learning the unusual Nix specific features may be a challenge, the power it affords to customize the system -- as much if not more than a Gentoo system, but in a simpler way than Gentoo -- may be worth the challenge.

What Works and What Doesn't

On my KDE NixOS almost everything works. Immediately after installation, the few exceptions I noticed included backlight control, suspend to disk (hibernate), and sound from flash videos in Chromium. Now after learning about the appropriate attributes for incorporating the backlight control in the nix configuration and adding and enabling pulseaudio, only hibernation does not work. In both cases I'm sure an appropriate addition to the configuration.nix file will solve both problems.

The method I have used to make backlight control work in other Linux distributions does not work in NixOS because of the nonstandard directory structure. However, I an appropriate kernel module addition to the configuration file will fix this.

The hibernation on KDE's end works as usual, providing the sleep and hibernate options in the 'Leave' tab of the KDE launcher, and providing appropriate settings in the 'Power Management' module of 'System Settings'. The problem is that I have not provided the appropriate resume device or partition is not provided in the configuration file.

I believe I just found how to implement the backlight solution in the Nix configuration file. Once I fix these issues I will update Making Everything Work section of this page.

Installation

I used the NixOS live iso with KDE to install version 14.04.398.3e4e106 to a physical EFI machine with an integrated Intel graphics adpater. NixOS does not provide a graphical installer, even with the live KDE iso, so everything will have to be done on one of the consoles or a the included default KDE terminal program in the live environment.

Installation Tips

I will point out some important considerations and precautions here before describing the installation process.

  • It is a good idea to back up the contents of the EFI partition in addition to backing up whatever else is important to you. Some suggest having a backup of the partition table as well.
  • It is also a good idea to use some other graphical tool to create partitions to use for /home and / and to make a filesystem of choice on these partitions instead of the command line tools suggested in the NixOS manual. You should also apply a label to these partitions. You should also create a swap partition using a tool outside of the NixOS installation environment if you don't already on the disk from an installation of another distribution. I suggest that the swap partition should be as large as your RAM so if you use suspend to disk, the entire contents of your RAM can be written to the swap partition.
  • When you make a partition for NixOS's / partition you may want to make it larger than you do for another Linux installation. The reason for this is that NixOS essentially makes a duplicate installation every time you make a change to the configuration file, allowing you to roll back to any configuration that has not been purged from the system. The drawback is that it will take up more space in /.
  • You will need to have a working network connection for the installation. If you dont want to use wpa_supplicant, as that is the only form of controlling a wireless network that is provided on the KDE live environment, you will want to have a wired connection available.
  • Include in the system packages and enable pulse audio in the configuration.
  • Include the attributes for allowing non free packages, permitting the inclusion of Flash in Firefox and Chromium.

Installer

NixOS doesn't have a traditional graphical installation program as do most other Linux distributions. In fact the installer is just the command line nixos-install, which copies all of the neccessary files to realize the declared system in the configuration file. The standard Linux/GNU tools are available to perform some necessary tasks such as creating partitions and creating and mounting file systems. In the live iso, the gaphical text editor Kate is available to edit the configuration files, as well as terminal text editors like vim.

Creating and labeling partitions and initializing filesystems for the NixOS installation.
This was done on a Sabayon 14.08 installation on the same system.

A working internet connection is necessary to perform the installation as some files and patches are downloaded from NixOS's servers. If you want to use a wireless network, you will need to either create and edit the wpa_supplicant configuration file with the settings for the network you want to use, or use wpa_supplicants tools from the command line.

Bootloader

The GRUB bootloader or gummiboot, for a BIOS system or an EFI system, respectively, must be declared in the Nix configuration file to boot NixOS. If using GRUB the disk on which the bootloader should be installed also needs to be specified. If installing on an EFI system gummiboot is installed in the EFI partition without affecting bootloaders already present in the partition. The available attributes affecting the operation of the bootloader are documented along with all of the other attributes which can be used in the configuration file.

Installation Process

Boot the computer using the iso.

At the command prompt login with the username: root leaving the password blank. At the next prompt enter

start display-manager
to start the KDE environment.

Start KDE's default terminal emulator program for the rest of the installtion.

  1. Mount the partition prepared in advance for the NixOS / directory.
    mount /dev/disk/by-label/NixOS-ROOT /mnt
    This method of referring to the partition works if you have already labeled the partition "NixOS-ROOT". You can also refer to it using the by typical identification and mount it using,
    mount /dev/sda13 /mnt
    Be sure to change /dev/sda13 to the right device name on your system.
  2. Use KDE's file browser Dolphin to create two directories, /home/ and /boot/, in the mounted root filesystem. Or if you prefer use the command line to make these two directories with
    mkdir /mnt/home
    and
    mkdir /mnt/boot
  3. Mount the partition prepared for the NixOS /home directory.
    mount /dev/disk/by-label/NixOS-HOME /mnt/home
    This method of referring to the partition works if you have already labeled the partition "NixOS-HOME". You can also refer to it using the by typical block device name identification and mount it using,
    mount /dev/sda14 /mnt/home
    Again, be sure to change /dev/sda14 to the right device name on your system.
  4. Activate the already created swap partition using,
    swapon /dev/sda8
    Don't forget to use the right block device name.
  5. Mount the EFI System partition, not forgetting to use the appropriate block device name
    mount /dev/sda2 /mnt/boot
    Don't forget to use the right block device name.
  6. All of the references to the partitions to be mounted can made by other identifiers, for example by the UUID of the partition. Use mount -h for the options.
  7. Generate the hardware-configuration.nix and the all-important configuration.nix files by issuing the command:

    nixos-generate-config --root /mnt
    The default files generated by this command look like these: hardware-configuration.nix and configuration.nix. The hardware-configuration.nix file configures the system with the necessary kernel modules by initrd to load whatever it needs to load and the necessary to load for operation after boot. Whatever other kernel modules are necessary to make the system work as well as it should can be added to the configuration.nix file. This file also specifies the partitions to be mounted and the swap partition that needs to be activated.

    The configuration.nix file needs to be edited -- continuing the installation without modifying this file will leave you with a system that boots into a console prompt, without an X Windows system, a desktop, without networking, and without any users except root without a password. (Although you can add a user here, for stability reasons, you should add a user later, after reboot)

    You can look at this configuration file to see how I added X services, KDE desktop and apps, and enabled networking, including network management using KDE's own tools like the Network Management widget. The configuration also adds Firefox (Nightly is what is provided by NixOS without specifying a version) and Chromium with Flash plugins. I also specified an intel video driver for use with the xserver but it did not help the acklight problem.

    Appendix B of the NixOS manual provides all of the available settings for the configuration file. Other sections of the manual describe some of the powerful features of the language that allow you to make an elegant and sophisticated configuration file.

  8. The last step before reboot is the command that starts the actual installation.
    nixos install
    The installer then copies the files to the installation file system and builds the system. It may take 30 minutes to finish with the configuration I used, depending on network speed. When installation is completed successfully you will have the following messages before being returned to the command prompt:
    
    created 2000 symlinks in the user enviroment
    finalizing the installation
    created /boot/EFI/gummiboot
    created /boot/EFI/Boot
    created /boot/loader/entries
    created 2000 symlinks in the user enviroment
    copied /nix/store/ ... gummibootx64.efi to /boot/EFI/gummiboot/gummibootx64.efi<
    copied /nix/store/ ... gummibootx64.efi to /boot/EFI/Boot/Bootx64.efi
    created EFI boot entry Linux Boot Manager
  9. When you reboot the system the KDE starts and you will be presented with the KDM login prompt. Open a console by pressing Control+Alt+F2 or Control+Alt+F2 or Control+Alt+any function key between F2 and F6 that gives you a console command prompt. At the login prompt enter root as the user, leave the password empty. At the root command prompt use
    useradd -m -G wheel networkmanagement -c 'Real Name' username
    to create a regular that is a member of the networkmanagement and the wheel group, permitting network control using Network Manager and the use of sudo to run single commands with administrator privilages. Then create a passowrd for this new user using
    passwd username
    You will be prompted to enter a username twice. Then change the root password using the same command.
  10. Reboot the system from the root console prompt
    reboot

After Installation

After installation you will probably find that you have not included all of the packages you want in your initial configuration file or you have not installed and enabled features necessary for the proper operation of your system. You simply need to edit the configuration file run nixos-rebuild switch and Nix will take care of the rest. Some of my oversights or ignorance during my installation were

  • not installing and enabling pulseaudio
  • not enabling non free components in nixpkgs
  • not knowing how to apply the backlight control solution
  • not setting the time zone attributes
  • not enabling the necessary attributes for sleep and hibernation (This is not a priority for my computer so I have not implemented the solution, which I assume means specifying a resume device and appropriate acpi components.
  • not installing gpg packages

I'm sure there are other issues that I have not noticed yet. Solutions to some of the ones I have found are presented below.

Making Everything Work

Backlight Control

I was able to fix the inability to control the backlight by adapting the solution for Linux with a standard directory structure to NixOS's unique system configuration method. The solution involves assigning some more values to attributes related to the xserver service. Modifying the xserver attributes that were in my first configuration.nix file, as in the following code,

    services.xserver = {

      enable = true;
      layout = "us";

      synaptics = {

	enable = true;

	};

      videoDriver = "intel";
      vaapiDrivers = [ pkgs.vaapiIntel ];

      deviceSection = ''
	#Identifier "Intel Graphics"
	Option "AccelMethod" "sna"
	Option "Backlight" "intel_backlight"
	BusID "PCI:0:2:0"
      '';

    };

		  

allowed me to regain control of the backlight. After building the new configuration with nixos-rebuild switch and rebooting, backlight control using the keyboard keys worked, also activating the OSD display of the backlight level. This also fixed the problem where when using the power panel widget to adjust brightness, the widget display showed the backlight level changing, without actually changing the backlight level. Note that #Identifier "Intel Graphics" is commented out in the nix configuration file because this text caused the display manager to not start when including it, although the same line as used in a standard Linux it had no negative effect that I could see. Using Identifier "intel" instead probably would not have caused any problems.

Installing and enabling pulseaudio

Only some but not all profiles of the audio hardware, correctly identified by Nix, were able to be configured in the KDE System Settings Multimedia component. Also, audio in Flash videos did not play. Adding

pulseaudio

to

environment.systemPackages

and

hardware.pulseaudio.enable = true

anywhere in in the configuration file fixes this issue.

Allowing installation of non-free packages and enabling non-free plugins

Adding the following code to the configuration file enables the installtion of non free packages and the lines pertaining to Firefox and Chromium allow the specified plugins.

    nixpkgs.config = {

	allowUnfree = true;

	firefox = {
	  #enableGoogleTalkPlugin = true;
	  enableAdobeFlash = true;
	};

	chromium = {
	  enablePepperFlash = true; # Adobe flash no longer supported in Chromium
	  enablePepperPDF = true;
	};
      }

Note that the nixpkgs.config attribute in the configuration file is a method of configuring installed packages. The same attribute is available for the non-declarative method of installing packages by creating an appropriately named settings file in the home directory of the user.

Time Zone Settings

Time settings are some of those properties that can't be controlled by the relevant KDE System Settings component.

  time.hardwareClockInLocalTime = true;
  time.timeZone = "America/New_York";
		        

Sleep and Hibernate

My current configuration file allows sleep but forces me to close and open the lid to resume if the lid is not already closed. Hibrnate does not work at all. I did encounter a sample configuration file that showed the appropriate attributes for a BIOS system but I failed to note it, but involved specifying a resume device.

PGP

I neglected to install a PGP package in my initial configuration. Some implementation of PGP is necessary to verify downloads of optional KDE components from within System Settings. After I included

gnupg

and

kde4.kgpg I haven't seen any errors related to PGP.

I highly recommend the KDE networking component and the Network Management widget. Including

kde4.kdenetwork

and

kde4.networkmanagement

to the environment.systemPackages list installs these components. Firefox (or more accurately Nightly, the Firefox nightly build) with plugins can be installed with

firefoxWrapper.

I also suggest Chromium and Cairo Dock, the latter of which is not available in the NixOS channel, but as you know by now it is easy to include an expression for building Cairo Dock into the configuration file as long as a url for an appropriate tar source package is available. I think any other packages will depend on your specific use case. You can see the other software I have specified system-wide in my configuration file.

Playing an FLV video
Dragon Player must be one of the packages in kde4.kdemultimedia

In a past installation, before a hard drive upgrade, I had texlive components and a custom lyx build, which I will install again but with a custom texlive after I cycle through other Linux distributions.

Software and Package Management System

Repositories or Channels

NixOS offers two package repositories, the standard stable repository or channel, and an unstable channel that offers development versions. The installation by default subscribes the system to the same channel as the version of the installation medium. Since I installed version 14.04, the system was subscribed to the nixos-14.04 channel. Other channels currently available are nixos-13.10 and nixos-unstable. The previous version channel will remain available until the next version is released.

After installation the system can be updated to the latest package version available in the channel using

nixos-rebuild switch --upgrade

Managing Packages

Package management (installing, removing, and updating packages) is performed entirely by command line tools as there are no graphical tools available except an experimental web based one developed by a NixOS user.

Searching for Packages

Simply searching for packages, however, can either be done by terminal tools or by using the package search page of the NixOS site.

Searhing for packages using the Nix web package search

NixOS maintains a useful on its website.

Package Search on the NIXOS Website
A search for filezilla returns a result with the package name and version and the package attribute, using the latter is faster.

Selecting a package from the result.

Selecting a search result provides other information including a link to the nix expression

Opening the link to the expression shows the script used to build the package
This can be used as a template to build your own customized version of the package or a package that is not available on NixOS

-- a script similar to a Gentoo ebuild -- used to build the package.

Searhing for Packages in a Terminal

The command line nix-env is the basic tool that performs many tasks related to package management outside of the configuration file. To use this effectively to search for packages you will have to look at this commands help option and be familiar with some core utilities such as grep, cut, and | to make it easier to sort the useful parts of the results. For example

nix-env -qa \*
lists all available packages by attribute. If you use
nix-env -qa \* | grep kde4
, for example, you will find packages that include "kde4" in the package name.

Installing Packages

Installing Packages Declaratively

As mentioned briefly above, the preferred method method of managing packages is through the configuration.nix file. Packages can be added by including them in the list of sytem-wide packages that can be rolled back and selected at boot as part of the entire system.

environment.systemPackages = with pkgs; [

      kde4.networkmanagement

      ....

      gnupg

  ];

In the above snippit, the packages kde4.networkmanagement and gnupg are installed -- included in the configuration -- system-wide. Note that if you don't include with pkgs; in

environment.systemPackages = with pkgs;,

you will have to prefix each of the package names with pkgs.. To put the configuration into effect, use

nixos-rebuild switch
, which rebuilds the configuration and activates it immediately and sets it as the default configuration to boot. Certain system services like the display manager are not activated immediately, but only after reboot
nixos-rebuild
has various other options that do not activate the configuration immediately, such as an option to build but not activate, an option to run the configuration in a virtual container, and an option to name the configuration, among others.

Installing Packages Non-Declaratively

As mentioned before, the nix-env command is the primary command for package management outside of the configuration.nix file. It can be used to install packages non-declaratively on a per-user basis -- it installs for the user that executed it, without requiring root privilages, and without affecting the system-wide configuration.

nix-env -i filezilla
installs filezilla. This searches all available packages' names to find the filezilla package. A faster install results by using the attribute option and the attribute name, as in
nix-env -iA nixos.pkgs.filezilla
Packages installed with the nix-env command can be uninstalled using the same command.
nix-env -e filezilla
will uninstall filezilla. Like the system-wide configuration, packages installed by nix-env can be rolled back with the --rollback option. It is a good idea to use the command's help option to learn its usage and available options, as there are many.

The nix-env -h is helpful for learning the command's capabilities as well as the NixOS wiki page on installing and removing software.

Configuration Rollback

Declarative Configuration Rollback

Each time a the configuration file is modified, the updated configuration has to be built and activated using

nixos-rebuild switch
If there is a problem with the configuration after switching to it, the configuration can be rolled back to the previous one by entering
nixos-rebuild switch --rollback
. The configuration can also be rolled back to a specific generation instead of the previous one. First, the available generations (past configurations) can be listed using
nix-env -p /nix/var/nix/profiles/system --list-generations
Then the system can be rolled back to a specific generation using

nix-env --switch-generation XXXX -p /nix/var/nix/profiles/system/nix/var/nix/profiles/system/bin/switch-to-configuration switch

where XXXX is one of the available generations as indicated by the output of the previous command.

This is a very impressive feature of NixOS, that I appreciated when a change to the configuration to fix the backlight control resulted in a display-manager that would not start.

Ad Hoc Configuration Rollback

Any change to the per-user profile, such as a package installation, can also be rolled back with the command

nix-env --rollback
.

Documentation and Help

NixOS has excellent documentation in the form of three full online manuals -- NixOS Manual, which describes the installation and configuration of the OS, Nixpkgs Contributors Guide, which describes the Nix expression language used in configuring NixOS and building packages in NixOS, and Nix User's Guide, which describes the Nix package manager. The first of these manuals is necessary reading as it not only gives installation and basic package management instruction, but because it lists all of the attributes that can be specified in the configuration.nix file and all of its secondary input files. Knowing these attributes is essential because, unlike standard Linux distributions that adhere to the conventional file hierarchy they are the only way of configuring settings. For example setting the machine hostname in a standard Linux involves editing /etc/hostname, or some similar file which does not exist in NixOS, but in NixOS the attribute networking.hostName must be set with the value.

The second manual is less essential, but if you stick with NixOS for more than just a cursory look, you will need to at least look at the very short seco nd chapter because you will have a problem with some available package or there is no package or expression built in the repository, and you will have to include a custom expression in your configuration. If you stick with NixOS more than a couple of months, I suspect you will need to refer to the third manual to handle the collisions that can occur after a nixos-rebuild switch or the situations where nixos-rebuild switch completely fails to build a configuration for some reason.

Other pieces of essential documentation are the NixOS Wiki pages giving the quick start info on package management and listing some KDE metapackages that should be specified in the configuration to give decent KDE desktop functionality.

Conclusion

NixOS was an interesting experience and I appreciated the benefits of its innovative architecture, including

  • the ability to customize its configuration in every aspect, only including features I want in its configuration, and specifying customized packages in its configuration
  • the ease with which this configuration could be done using a single configuration file, or using a single main configuration file and secondary configuration files that are imported or included in the main configuration file
  • the ease in building a custom package where the entire process of the build can be specified in the configuration file (as long as the nix expression or the build script is available)
  • the ability to rollback the configuration if a change resulted in someting undesired, and the ability to choose a configuration, even a named configuration, to boot into when starting NixOS

.

However, from my prespective there are problems with it that will prevent it from being one of the OSes I regularly use on my multi-boot system, and I suspect will prevent most users from using it regularly as well. I could have lived with some of these drawbacks, but taken together, they make NixOS an inefficient tool to do the work of someone who is not a computer scientist or the administrator of a large number of systems with similar configurations.

  • The use of gummiboot, which can't boot other Linuxes, and prevents other Linuxes that use GRUB from booting NixOS, at least not without modification. I could live with this but most users won't.
  • The non-standard directory system will not be liked by some users, but this is a result of the way the NixOS's innovation is implemented and must be accepted to enjoy its benefits. With some investment in learning nix expressions, the benefits would outweigh the difficulties.
  • It seems that the package maintenance in the repositories is informal without consistent standards, resulting in features being arbitrarily being removed and added in each new build of a package. Anyone who wants to use NixOS and needs certain software they may have to accept that they will have to build a custom version for themselves. Fortunately NixOS makes this very easy, after the initial investment in time.
  • Collisions occur between packages during the building of the system-wide configuration that are not resolved by the nix package management system. The system does not offer clues as to which package or meta package specifications resulted in the conflict nor does it offer a set of choices that the user can select to resolve the collision.
  • After two months away from NixOS, I came back to it and performed the steps to update the system. During the build of the update, the configuration failed because of an error in a source url, required to build an updated package.

I could accept the first three difficulties in this list, but the last two, for me, are too much, preventing NixOS from being a useful tool and not just an interesting experiment.