From def1e23be848848400d1d097d4f044e3c401f9dd Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sun, 14 Apr 2024 23:02:32 +0200 Subject: treewide: remove lib.mdDoc --- modules/system/version.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'modules/system/version.nix') diff --git a/modules/system/version.nix b/modules/system/version.nix index 3effb50..fa6ce6e 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -36,7 +36,7 @@ in system.stateVersion = mkOption { type = types.int; default = 4; - description = lib.mdDoc '' + description = '' Every once in a while, a new NixOS release may change configuration defaults in a way incompatible with stateful data. For instance, if the default version of PostgreSQL @@ -51,14 +51,14 @@ in system.darwinLabel = mkOption { type = types.str; - description = lib.mdDoc "Label to be used in the names of generated outputs."; + description = "Label to be used in the names of generated outputs."; }; system.darwinVersion = mkOption { internal = true; type = types.str; default = "darwin${toString cfg.stateVersion}${cfg.darwinVersionSuffix}"; - description = lib.mdDoc "The full darwin version (e.g. `darwin4.2abdb5a`)."; + description = "The full darwin version (e.g. `darwin4.2abdb5a`)."; }; system.darwinVersionSuffix = mkOption { @@ -67,28 +67,28 @@ in default = if cfg.darwinRevision != null then ".${substring 0 7 cfg.darwinRevision}" else ""; - description = lib.mdDoc "The short darwin version suffix (e.g. `.2abdb5a`)."; + description = "The short darwin version suffix (e.g. `.2abdb5a`)."; }; system.darwinRevision = mkOption { internal = true; type = types.nullOr types.str; default = gitRevision (toString ../..); - description = lib.mdDoc "The darwin git revision from which this configuration was built."; + description = "The darwin git revision from which this configuration was built."; }; system.nixpkgsRelease = mkOption { readOnly = true; type = types.str; default = lib.trivial.release; - description = lib.mdDoc "The nixpkgs release (e.g. `16.03`)."; + description = "The nixpkgs release (e.g. `16.03`)."; }; system.nixpkgsVersion = mkOption { internal = true; type = types.str; default = cfg.nixpkgsRelease + cfg.nixpkgsVersionSuffix; - description = lib.mdDoc "The full nixpkgs version (e.g. `16.03.1160.f2d4ee1`)."; + description = "The full nixpkgs version (e.g. `16.03.1160.f2d4ee1`)."; }; system.nixpkgsVersionSuffix = mkOption { @@ -97,7 +97,7 @@ in default = if useSourceRevision then ".${lib.substring 0 8 (nixpkgsSrc.lastModifiedDate or nixpkgsSrc.lastModified or "19700101")}.${nixpkgsSrc.shortRev or "dirty"}" else lib.trivial.versionSuffix; - description = lib.mdDoc "The short nixpkgs version suffix (e.g. `.1160.f2d4ee1`)."; + description = "The short nixpkgs version suffix (e.g. `.1160.f2d4ee1`)."; }; system.nixpkgsRevision = mkOption { @@ -106,13 +106,13 @@ in default = if useSourceRevision && nixpkgsSrc ? rev then nixpkgsSrc.rev else lib.trivial.revisionWithDefault null; - description = lib.mdDoc "The nixpkgs git revision from which this configuration was built."; + description = "The nixpkgs git revision from which this configuration was built."; }; system.configurationRevision = mkOption { type = types.nullOr types.str; default = null; - description = lib.mdDoc "The Git revision of the top-level flake from which this configuration was built."; + description = "The Git revision of the top-level flake from which this configuration was built."; }; }; -- cgit v1.2.3 From 88b97aa49c451070d2978b291a6280f2e1c5c2b6 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 10 Sep 2024 16:17:57 +0100 Subject: {ids,checks}: update for new builder UID/GID values --- modules/system/version.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/system/version.nix') diff --git a/modules/system/version.nix b/modules/system/version.nix index fa6ce6e..df8b7a0 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -35,7 +35,7 @@ in options = { system.stateVersion = mkOption { type = types.int; - default = 4; + default = 5; description = '' Every once in a while, a new NixOS release may change configuration defaults in a way incompatible with stateful -- cgit v1.2.3 From 04e3cfc822568d354b540a3207121af27b699057 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 12 Sep 2024 17:21:48 +0100 Subject: version: make `system.stateVersion` mandatory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When testing the Sequoia UID change, I discovered that @mjm didn’t have `system.stateVersion` set; I suspect this is not too uncommon. Let’s make it required now, like NixOS is trying to, to improve our backwards‐compatibility story in anticipation of starting to cut release branches. --- modules/system/version.nix | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'modules/system/version.nix') diff --git a/modules/system/version.nix b/modules/system/version.nix index df8b7a0..826ad35 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -5,8 +5,6 @@ with lib; let cfg = config.system; - defaultStateVersion = options.system.stateVersion.default; - # Based on `lib.trivial.revisionWithDefault` from nixpkgs. gitRevision = path: if pathIsGitRepo "${path}/.git" @@ -34,8 +32,9 @@ in { options = { system.stateVersion = mkOption { - type = types.int; - default = 5; + type = types.ints.between 1 config.system.maxStateVersion; + # TODO: Remove this default and the assertion below. + default = config.system.maxStateVersion; description = '' Every once in a while, a new NixOS release may change configuration defaults in a way incompatible with stateful @@ -49,6 +48,12 @@ in ''; }; + system.maxStateVersion = mkOption { + internal = true; + type = types.int; + default = 5; + }; + system.darwinLabel = mkOption { type = types.str; description = "Label to be used in the names of generated outputs."; @@ -121,9 +126,22 @@ in # documentation is not reprocessed on every commit system.darwinLabel = mkDefault "${cfg.nixpkgsVersion}+${cfg.darwinVersion}"; - assertions = [ { - assertion = cfg.stateVersion <= defaultStateVersion; - message = "system.stateVersion = ${toString cfg.stateVersion}; is not a valid value"; - } ]; + assertions = [ + { + assertion = options.system.stateVersion.highestPrio != (lib.mkOptionDefault { }).priority; + message = '' + The `system.stateVersion` option is not defined in your + nix-darwin configuration. The value is used to conditionalize + backwards‐incompatible changes in default settings. You should + usually set this once when installing nix-darwin on a new system + and then never change it (at least without reading all the relevant + entries in the changelog using `darwin-rebuild changelog`). + + You can use the current value for new installations as follows: + + system.stateVersion = ${toString config.system.maxStateVersion}; + ''; + } + ]; }; } -- cgit v1.2.3 From 8a3ea966bcb14655b231308e9d52195715c71692 Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 8 Jan 2025 19:10:22 +0000 Subject: version: implement nix-darwin release versions --- modules/system/version.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'modules/system/version.nix') diff --git a/modules/system/version.nix b/modules/system/version.nix index 826ad35..54829d1 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -59,11 +59,18 @@ in description = "Label to be used in the names of generated outputs."; }; + system.darwinRelease = mkOption { + readOnly = true; + type = types.str; + default = (lib.importJSON ../../version.json).release; + description = "The nix-darwin release (e.g. `24.11`)."; + }; + system.darwinVersion = mkOption { internal = true; type = types.str; - default = "darwin${toString cfg.stateVersion}${cfg.darwinVersionSuffix}"; - description = "The full darwin version (e.g. `darwin4.2abdb5a`)."; + default = cfg.darwinRelease + cfg.darwinVersionSuffix; + description = "The full nix-darwin version (e.g. `24.11.2abdb5a`)."; }; system.darwinVersionSuffix = mkOption { @@ -72,7 +79,7 @@ in default = if cfg.darwinRevision != null then ".${substring 0 7 cfg.darwinRevision}" else ""; - description = "The short darwin version suffix (e.g. `.2abdb5a`)."; + description = "The short nix-darwin version suffix (e.g. `.2abdb5a`)."; }; system.darwinRevision = mkOption { @@ -86,14 +93,15 @@ in readOnly = true; type = types.str; default = lib.trivial.release; - description = "The nixpkgs release (e.g. `16.03`)."; + description = "The nixpkgs release (e.g. `24.11`)."; }; + # TODO: Shouldn’t mismatch the Darwin release, rethink all this… system.nixpkgsVersion = mkOption { internal = true; type = types.str; default = cfg.nixpkgsRelease + cfg.nixpkgsVersionSuffix; - description = "The full nixpkgs version (e.g. `16.03.1160.f2d4ee1`)."; + description = "The full nixpkgs version (e.g. `24.11.1160.f2d4ee1`)."; }; system.nixpkgsVersionSuffix = mkOption { @@ -124,7 +132,7 @@ in config = { # This default is set here rather than up there so that the options # documentation is not reprocessed on every commit - system.darwinLabel = mkDefault "${cfg.nixpkgsVersion}+${cfg.darwinVersion}"; + system.darwinLabel = mkDefault cfg.darwinVersion; assertions = [ { -- cgit v1.2.3