version: add `isReleaseBranch`

This commit is contained in:
Emily 2023-07-15 16:47:19 +01:00
parent 1add3c3a99
commit 23ad3d2b53
4 changed files with 28 additions and 4 deletions

View File

@ -16,6 +16,13 @@ but could theoretically break
if you have very complex bash expressions in a session variable.
Please report any issues you experience.
* The `.release` file in the Home Manager source tree
has been supplanted by `release.json`,
which contains more information about the branch.
If you have any external code reading this file,
please migrate to using `release.json` instead.
The `.release` file will be removed in 24.05.
[[sec-release-23.11-state-version-changes]]
=== State Version Changes

View File

@ -483,8 +483,8 @@ in
warnings =
let
hmRelease = fileContents ../.release;
nixpkgsRelease = pkgs.lib.trivial.release;
hmRelease = config.home.version.release;
nixpkgsRelease = lib.trivial.release;
releaseMismatch =
config.home.enableNixpkgsReleaseCheck
&& hmRelease != nixpkgsRelease;

View File

@ -2,7 +2,9 @@
with lib;
{
let releaseInfo = lib.importJSON ../../release.json;
in {
options = {
home.stateVersion = mkOption {
type = types.enum [
@ -51,11 +53,22 @@ with lib;
internal = true;
readOnly = true;
type = types.str;
default = fileContents ../../.release;
default = releaseInfo.release;
example = "22.11";
description = "The Home Manager release.";
};
isReleaseBranch = mkOption {
internal = true;
readOnly = true;
type = types.bool;
default = releaseInfo.isReleaseBranch;
description = ''
Whether the Home Manager version is from a versioned
release branch.
'';
};
revision = mkOption {
internal = true;
type = types.nullOr types.str;

4
release.json Normal file
View File

@ -0,0 +1,4 @@
{
"release": "23.11",
"isReleaseBranch": false
}