NixOS: a purely functional Linux distribution

Existing package and system configuration management tools suffer from an imperative model, where system administration actions such as upgrading packages or changes to system configuration files are stateful: they destructively update the state of the system. This leads to many problems, such as the inability to roll back changes easily, to run multiple versions of a package side-by-side, to reproduce a configuration deterministically on another machine, or to reliably upgrade a system. In this paper we show that we can overcome these problems by moving to a purely functional system configuration model. This means that all static parts of a system (such as software packages, configuration files and system startup scripts) are built by pure functions and are immutable, stored in a way analogously to a heap in a purely function language. We have implemented this model in NixOS, a non-trivial Linux distribution that uses the Nix package manager to build the entire system configuration from a purely functional specification.

[1]  Roberto Di Cosmo,et al.  Package upgrades in FOSS distributions: details and challenges , 2008, HotSWUp '08.

[2]  Eric Foster-Johnson Red Hat RPM guide , 2002 .

[3]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.

[4]  Marshall K. McKusick,et al.  Union Mounts in 4.4BSD-Lite , 1995, USENIX.

[5]  David Fox,et al.  Experience report: using functional programming to manage a linux distribution , 2007, ICFP '07.

[6]  Eelco Dolstra,et al.  Maximal Laziness: An Efficient Interpretation Technique for Purely Functional DSLs , 2009, LDTA.

[7]  Eelco Dolstra Secure sharing between untrusted users in a transparent source/binary deployment model , 2005, ASE '05.

[8]  Eelco Dolstra,et al.  The purely functional software deployment model , 2006 .

[9]  Geoffrey Michael Clemm The Odin system: an object manager for extensible software environments , 1986 .

[10]  Merijn de Jonge,et al.  Imposing a memory management discipline on software deployment , 2004, Proceedings. 26th International Conference on Software Engineering.

[11]  Mark P. Jones,et al.  A principled approach to operating system construction in Haskell , 2005, ICFP '05.

[12]  Geoffrey Clemm The Odin System , 1995, SCM.

[13]  Allan Heydon,et al.  Caching function calls using precise dependencies , 2000, PLDI '00.

[14]  John Hart,et al.  An Analysis of RPM Validation Drift , 2002, LISA.

[15]  Paul Hudak,et al.  Conception, evolution, and application of functional programming languages , 1989, CSUR.

[16]  Eelco Dolstra,et al.  Purely Functional System Configuration Management , 2007, HotOS.

[17]  Stuart I. Feldman,et al.  Make — a program for maintaining computer programs , 1979, Softw. Pract. Exp..

[18]  David B. Tucker Applying Module System Research to Package Management , 2002 .

[19]  Mark Burgess,et al.  A Site Configuration Engine , 1995, Comput. Syst..

[20]  John DeTreville Making System Configuration More Declarative , 2005, HotOS.

[21]  Steve Traugott,et al.  Why Order Matters: Turing Equivalence in Automated Systems Administration , 2002, LISA.

[22]  Hans-Juergen Boehm Space efficient conservative garbage collection , 2004, SIGP.

[23]  Craig A. Knoblock,et al.  Advanced Programming in the UNIX Environment , 1992, Addison-Wesley professional computing series.

[24]  Allan Heydon,et al.  The Vesta Approach to Software Configuration Management , 2001 .

[25]  Luke Kanies ISconf: Theory, Practice, and Beyond , 2003, LISA.

[26]  Anthony M. Sloane,et al.  Post-design domain-specific language embedding: a case study in the software engineering domain , 2002, Proceedings of the 35th Annual Hawaii International Conference on System Sciences.