NixCon 2020: Online Edition

nix-processmgmt: An experimental Nix-based process manager-agnostic framework
10-17, 11:45–12:10 (UTC), Main Stream

Nix is package manager that offers all kinds of powerful features to make package deployments reliable and reproducible. Although Nix can be used to conveniently deploy packages, on various operating systems (such as Linux and macOS), and even allows unprivileged users to deploy packages, deploying services (such as PostgreSQL and Apache HTTPD) still has its limitations.

Currently, Nix-based service deployment is solved by a small number of solutions:

  • NixOS requires you to adopt a fully Nixified Linux system and uses systemd as a process manager.
  • nix-darwin only works on macOS with launchd as a process manager

If you are using Nix on a conventional Linux distribution, a different operating system (e.g. FreeBSD), with a different process manager (e.g. supervisord), or as an unprivileged user, then there is no off-the-shelf solution that can help you (yet) to conveniently deploy Nix-provided services.

The nix-processmgmt framework (https://github.com/svanderburg/nix-processmgmt) is a prototype that tries to provide universal Nix-based service deployment on all systems where Nix can be used.

It offers the following features:
* It uses simple conventions for describing process instances, e.g. function definitions and function invocations
* It works with high-level deployment specifications that can universally target the following process managers: sysvinit, bsdrc, systemd, supervisord, cygrunsrv and launchd
* Tested on the following operating systems: Linux, macOS, Cygwin and FreeBSD
* Automatically derives the activation order from process dependencies
* Allows you to deploy multiple instances of the same service
* Unprivileged user deployments

In this talk, I will provide background information about this framework, describe how it works, and show a number of real-life usage scenarios using commonly used services (PostgreSQL, Apache HTTPD etc.) in a number of interesting usage scenarios (unprivileged user deployments, deployment on FreeBSD etc.)

(Although the tool advertises itself as a prototype, it is already quite usable)

See also: Slides (1.1 MB)

I'm a Nix/Nixpkgs/NixOS contributor since 2007 who has worked on many things, such as FHS chroot environments, Nix android build environment. I'm also the main developer for various Nix-related utilities: Disnix, Dysnomia, node2nix, composer2nix.