For the majority of changes, it "just works". For example, here's the part of nixpkgs that configures wireless networking via wpa_supplicant, as well as the actual package build of wpa_supplicant:
Because they're contained within the same git repo, if a new version of wpa_supplicant changed the syntax of wpa_supplicant.conf, the upgrade could be handled easily (assuming the user-facing options in NixOS didn't need to change).
For more complicated changes, there's `system.stateVersion`:
An example of this would be if NixOS version A ships with Postgres version X by default, while NixOS version B upgrades to Postgres version Y. stateVersion allows a sane upgrade path where you can update to NixOS version B without breaking your database immediately (because stateVersion is still A).
https://github.com/NixOS/nixpkgs/blob/nixos-19.09/nixos/modu...
https://github.com/NixOS/nixpkgs/blob/nixos-19.09/pkgs/os-sp...
Because they're contained within the same git repo, if a new version of wpa_supplicant changed the syntax of wpa_supplicant.conf, the upgrade could be handled easily (assuming the user-facing options in NixOS didn't need to change).
For more complicated changes, there's `system.stateVersion`:
https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
An example of this would be if NixOS version A ships with Postgres version X by default, while NixOS version B upgrades to Postgres version Y. stateVersion allows a sane upgrade path where you can update to NixOS version B without breaking your database immediately (because stateVersion is still A).