Recently, I've switched to NixOS, making all my system declarative. In this post, I'll explain the pros, the cons, and if switching might be a good option for you.
To also answer your question directly: yes, this was indeed one of two initial motivations for Nix!
As such, you don’t even need to use NixOS to take advantage of it; you can just install Nix on whatever distro you’re already using (or even macOS) and start building separate dev environments for your projects.
Can I ask about the last bit? Is it like having different dev environments or profiles, and you can just use them as needed?
To also answer your question directly: yes, this was indeed one of two initial motivations for Nix!
As such, you don’t even need to use NixOS to take advantage of it; you can just install Nix on whatever distro you’re already using (or even macOS) and start building separate dev environments for your projects.