nixos: force the user to set system.stateVersion#149877
nixos: force the user to set system.stateVersion#149877zimbatm wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
FWIW I'm in favor. I've been wanting to do the same change in Home Manager. 👍 |
f3f2d37 to
a7595b4
Compare
|
Hmm, any ideas on how I can avoid setting a default value? |
The argument for introducing `system.stateVersion` was that some data that lives on disk, like the postgres database, would change shape depending on which release of NixOS the user was using. If the default is always the current version, it can lead to unwanted breakages. It's better to fail the evaluation and force the user to set something.
a7595b4 to
5343839
Compare
if we're understanding this correctly: don't give a default, and add an assertion for |
| { | ||
| system.nixos.versionSuffix = versionSuffix; | ||
| system.nixos.revision = nixpkgs.rev or nixpkgs.shortRev; | ||
| system.stateVersion = mkForce "21.04"; |
|
@zimbatm do you think we should continue with this? |
|
I don't think we should do this because |
|
Actually never mind. While |
|
I'm not sure. Forcing this would be the right thing to do. But it's also going to cause a lot of pain to existing users that only have warnings so far. Maybe it's best to bunch the change with Infinisil's proposal, so it's one change instead of two. |
|
Is it possible to require it only if the configuration includes some software/package/service that is affected by the stateVersion? Then we don't require it for most users, but prevent the risk of error. |
|
@ScottFreeCode Nice idea, I think that should work! |
|
it's time to close some old PRs |
The argument for introducing
system.stateVersionwas that some datathat lives on disk, like the postgres database, would change shape
depending on which release of NixOS the user was using.
If the default is always the current version, it can lead to unwanted
breakages. It's better to fail the evaluation and force the user to set
something.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes