Skip to content

nixos/version: Only warn about unset stateVersion if used (lite)#207958

Merged
roberth merged 4 commits intoNixOS:masterfrom
hercules-ci:nixos-only-warn-stateVersion-when-used-lite
Dec 28, 2022
Merged

nixos/version: Only warn about unset stateVersion if used (lite)#207958
roberth merged 4 commits intoNixOS:masterfrom
hercules-ci:nixos-only-warn-stateVersion-when-used-lite

Conversation

@roberth
Copy link
Member

@roberth roberth commented Dec 27, 2022

Description of changes

If a configuration does not use services that depend on the stateVersion, it does not need to be set.

This provides an incentive for services not to rely on stateVersion, and not to burden users with this.

Currently, it is still required by some modules, so to make a valid stateVersion-less configuration you'll have to use disabledModules.

This change forms the foundation of #207313, which has breaking changes, while this pr does not.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Dec 27, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Dec 27, 2022
@roberth roberth requested review from dasJ and mweinelt December 27, 2022 15:23
@dasJ
Copy link
Member

dasJ commented Dec 27, 2022

What about dropping the default altogether?

@roberth
Copy link
Member Author

roberth commented Dec 27, 2022

What about dropping the default altogether?

The default default or the macOS one? The macOS linux builder one seems valuable enough because it adds a bit of explanation.

I'm ok with removing the default from misc/version.nix, but that's a separate change and a separate discussion.

Copy link
Contributor

@Gabriella439 Gabriella439 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few small suggestions

If a configuration does not use services that depend on the
stateVersion, it does not need to be set.

This provides an incentive for services not to rely on
stateVersion, and not to burden users with this.
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 28, 2022
roberth and others added 2 commits December 28, 2022 14:38
The `system` argument is usually implied, and not hard to figure out.

Co-authored-by: Gabriella Gonzalez <[email protected]>
I was considering the broader context of stateVersion, but the
macos builder does not enable documentation, making this paragraph
a distraction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants