FAQ/When do I update stateVersion: Difference between revisions
Added note to helpful tool |
This is a complete rewrite of the page, adding more information, better references, and attempting to make it more clear that the value should never be changed; The old version was dangerously close to implying it could reasonably be changed. |
||
Line 1: | Line 1: | ||
{{FAQ/breadcrumb}}<onlyinclude> | {{FAQ/breadcrumb}}<onlyinclude> | ||
== Why am I told not to update<ref name=":0">https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion</ref> <code>system.stateVersion</code>? == | |||
Since it is not clearly codified what {{nixos:option|system.stateVersion}} should be used for, and it is used for a great many different things in practice<ref name=":1">https://discourse.nixos.org/t/using-hashes-for-stateversion-instead-of-human-readable-strings/61823/30</ref>, <strong>there is no practical way to ensure that changing it is ever safe</strong>. | |||
The consequences of changing its value range from none at all, to complete destruction of data written by specific software. | |||
< | == How do I update NixOS, if changing <code>system.stateVersion</code> does not do that? == | ||
See [[Updating NixOS#Changing Nixpkgs version|Updating nixos]]. | |||
== Why does <code>system.stateVersion</code> look like a NixOS version? == | |||
This is because it notes down the version of NixOS you first installed with a given configuration. It does not mean that you should update it. | |||
== When can I update <code>system.stateVersion</code> safely? == | |||
Currently, you cannot update it safely without a complete understanding of all NixOS modules you are using, directly or indirectly. | |||
Only when the NixOS release notes say that it can be changed, should it be changed. | |||
== Is it ok to leave <code>system.stateVersion</code> at a very old version? == | |||
The NixOS module authors are aware of their use of the setting, and must ensure that old versions continue to work. Whether and how this is sustainable is an upstream issue; Users should not update the setting unless instructed otherwise. | |||
== What even is <code>system.stateVersion</code> for, if it is just an unchanging string? == | |||
Generally, it is used to inform NixOS what versions of packages you might have previously installed. This is used to ensure correct data migration for certain packages<ref name=":0" />. Since NixOS configurations are stateless, and therefore cannot know what data may already be on your system, there is no other way to identify this. | |||
{{nixos:option|system.stateVersion}} in practice is also used for other potential issues that stem from version upgrades<ref name=":1" /> - it is somewhat controversial what and what not it should be used for, resulting in many different use cases. The current and historic lack of a clear definition of what it does is part of why it cannot be updated. | |||
== References == | == References == | ||
</noinclude> | </noinclude> |