nix processmgmt: An experimental Nix based process manager agnostic framework
Channel: NixCon
Date: 16/09/2022

nix-processmgmt: An experimental Nix-based process manager-agnostic framework - Sander van der Burg

2020-10-17 https://cfp.nixcon.org/nixcon2020/talk/TW79FU/

Nix is a package manager offering 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 several 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)