2 ms·
>How well does Nix interact with inherently stateful things like databases? This is a frequently asked question. Nix/Guix do not interact with such files, and
by davexunit 11y ago
>How well does Nix interact with inherently stateful things like databases?
This is a frequently asked question. Nix/Guix do not interact with such files, and we make it a point to differentiate between stateful and stateless. Nix and Guix manage the stateless, deterministic stuff, and system services or other mechanisms manage the stateful stuff. For example, there's a postgresql package in Guix, but installing it doesn't create a db cluster in /var/lib, it just installs the binaries, docs, etc to the user's package profile. However, GuixSD, the distro built on Guix, comes with a postgresql system service that creates the system db cluster before launching the postgresql server. In other words, stateful things are handled at a different layer than the packaging layer.
If a new version of an application requires a schema migration, then that would be something for a system service to perform with the updated binaries from the package manager. You still need to take care to back up your databases, home directories, etc.