Hello, I’m new to Nix and have a suggestion. If this has been proposed and evaluated previously, please ignore. I searched and didn’t find anything, but my search-fu may not be bulletproof.
And, I know you guys are busy prepping the 21.05 release, and it has been feature-frozen, so no need to take the time to reply now. Just want to get this idea in the record for possible future consideration.
Also, thanks to everyone who has built NixOS into what it is today. It is truly an amazing game changer and is one step further out of the tarpit.
Proposal: It might be a nice QoL addition if
nixos-rebuild would snapshot the configuration.nix it used, and store that somewhere out-of-the-way in the system profile it built.
If each system profile included a copy of the configuration.nix that built it, it would be easier to troubleshoot in case a new profile is broken in some way. Just diff the broken profile’s configuration.nix vs the prior working one.
I’m sure users can write some kind of hook in their configuration.nix to git commit or btrfs/zfs snapshot the configuration.nix on every
nixos-rebuild, but it might be nice to have this function by default.
I suggest this because my NixOS system recently broke after I made some additions to configuration.nix. But the only changes I remember making were adding some additional packages to environment.systemPackages. That shouldn’t have caused the system to fail to boot.
It had to be due to something else. A simple diff of the broken configuration.nix vs the prior working one would help track down the error. But I didn’t expect the new system to break and so didn’t make a backup copy of the working configuration.nix. So it might be nice if nixos-rebuild did that automatically.