Guix solves the same problem in similar ways, though it uses Scheme as its configuration language.
Sadly it doesn't work on macOS, unlike Nix.
Sadly it doesn't work on macOS, unlike Nix.