10 Feb 2015 rkrishnan   » (Journeyer)

NixOS

Posted on April 15, 2014 by rkrishnan

I am a long time (and proud) Debian GNU/Linux user and developer. As a debian developer, I have not been active for one or two years but off late, I am following mailing lists, uploading a package or two and starting to be more active.

I have also been getting more and more convinced that Functional Programming paradigms are more suited to solve problems than using imperative languages, at least for a lot of tasks. I have been learning Haskell for the past few months and thoroughly enjoy the beauty and expressiveness of Haskell and the purely functional programming which lends itself to many tasks. It has some kind of beauty that is only found in Mathematics, which I have never seen in any other programming language I ever use.

I also sometimes use a work Macbook Air machine. Since my work involves building linux kernel, making changes to it and so on, I generally work on GNU/Linux boxes. But sometimes I am not in the office or sitting on a couch and I really like the portability of the Macbook hardware. I am not a fan of Apple and do not intend to replace my PC hardware and the very nice Debian system with Apple hardware and software, expecially in the wake of Snowden revelations. But just to make my life easier while using the Mac, I had been looking at various “packaging” systems in the OS X.

People have attempted a few times to create a good packaging system for OS X. Mac-ports, the NetBSD pkgsrc and so on. And then there is homebrew which seem to be the current popular package manager, which was recommended to me by one of my friends who is a long time Apple aficionado.

The problem with brew is that it is source based. This is both good and bad. Bad because it takes me ages to get stuff built and installed. I would love to have binary packages available that can be readily installed. But then there is the binary compatibility between OS X versions. I admit to know nothing about the binary compatibility.

Enter NixOS. NixOS is a GNU/Linux distribution (well, they call it a linux distribution, but I prefer to call it GNU/Linux distro to give some credit to the GNU project which started this all and still contribute a big chunk of software we all use) that brings the concept of Purely Functional programming languages to an OS distro. What does that mean? It means many things.

  • if a package installation fails, it does not leave the system in a useless state. It is in the same state as we started with.
  • The expectations from the OS is “declared” in a configuration file written in a lazy, functional, dynamically typed language called nix expression.
  • One can roll back to any of the previous states of the system.
  • One can install multiple versions of a package. If a package is not used by any other package, it can be “garbage collected”.
  • One does not need any special privilages to install packages. Any user of the system can install packages.
  • NixOS does not have the traditional /etc, /usr, /bin and other directories. Instead, there is a ~/.nix-profile that takes care of linking to the package which is stored in the “nix store”.

If all these sound interesting (or not), I would encourage everyone to read this wonderfully detailed and readable paper on Nix.

Another thing to note. Nix is the name of the packaging system (like apt or rpm) and NixOS is the OS built around nix. Nix can be installed on any POSIX compatible OS like GNU/Linux, *BSD or OS X or any other Unix-like systems.

Nix packages are maintained via github. I don’t personally like such a crucially important project dependent on a commercial network infrastructure like github. But at the same time, I see that github “pull requests” is certainly one of the reasons why a project like Nix is able to keep up with the ever changing Free software versions and builds. It certainly reduces the bureaucracy.

I already sent a couple of pull requests which were merged readily. Github and the pull request mechanisms greatly reduce the barrier to contributions. But the same time, I should note that Debian’s trust model for developers using the GPG “web of trust” and signed package uploads exist for a reason. I wish more and more distributions adopt it.

My OS X experience is now a lot better. I have latest versions of a lot of packages installed. For those that are failing, I am trying to fix them and send the fixes in. And I am having a lot of fun learning about the Nix. There are many rough edges with Nix still. A lot of free software is not packaged yet and packaging itself is boring and a thankless job. But in my opinion the Nix expressions is a nice “Domain Specific Language” to do the packaging. I will certainly be playing with it more in the coming days. But of course, I do not plan to stop using Debian any time soon.

Syndicated 2014-04-15 00:00:00 from Ramakrishnan Muthukrishnan

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!