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. if you have very complex bash expressions in a session variable.
Please report any issues you experience. 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]] [[sec-release-23.11-state-version-changes]]
=== State Version Changes === State Version Changes

View file

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

View file

@ -2,7 +2,9 @@
with lib; with lib;
{ let releaseInfo = lib.importJSON ../../release.json;
in {
options = { options = {
home.stateVersion = mkOption { home.stateVersion = mkOption {
type = types.enum [ type = types.enum [
@ -51,11 +53,22 @@ with lib;
internal = true; internal = true;
readOnly = true; readOnly = true;
type = types.str; type = types.str;
default = fileContents ../../.release; default = releaseInfo.release;
example = "22.11"; example = "22.11";
description = "The Home Manager release."; 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 { revision = mkOption {
internal = true; internal = true;
type = types.nullOr types.str; type = types.nullOr types.str;

4
release.json Normal file
View file

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