Merge branch 'release-check' into 'master'

Check release version compat, stop testing stable NixOS

See merge request simple-nixos-mailserver/nixos-mailserver!440
This commit is contained in:
Martin Weinelt
2025-11-08 12:57:49 +00:00
4 changed files with 43 additions and 25 deletions

View File

@@ -41,6 +41,21 @@ in
options.mailserver = {
enable = mkEnableOption "nixos-mailserver";
enableNixpkgsReleaseCheck = mkOption {
type = types.bool;
default = true;
description = ''
Whether to check for a release mismatch between NixOS mailserver and
Nixpkgs.
Using mismatched versions is likely to cause compatibility issues
and may require migrations that make an eventual rollback tricky.
It is therefore highly recommended to use a release of NixOS mailserver
that corresponds with your chosen release of Nixpkgs.
'';
};
stateVersion = mkOption {
type = types.nullOr types.ints.positive;
default = null;

19
flake.lock generated
View File

@@ -93,29 +93,12 @@
"type": "github"
}
},
"nixpkgs-25_05": {
"locked": {
"lastModified": 1761999846,
"narHash": "sha256-IYlYnp4O4dzEpL77BD/lj5NnJy2J8qbHkNSFiPBCbqo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3de8f8d73e35724bf9abef41f1bdbedda1e14a31",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"blobs": "blobs",
"flake-compat": "flake-compat",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs",
"nixpkgs-25_05": "nixpkgs-25_05"
"nixpkgs": "nixpkgs"
}
}
},

View File

@@ -13,7 +13,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-25_05.url = "github:NixOS/nixpkgs/nixos-25.05";
blobs = {
url = "gitlab:simple-nixos-mailserver/blobs";
flake = false;
@@ -26,7 +25,6 @@
blobs,
git-hooks,
nixpkgs,
nixpkgs-25_05,
...
}:
let
@@ -39,11 +37,6 @@
nixpkgs = nixpkgs;
pkgs = nixpkgs.legacyPackages.${system};
}
{
name = "25.05";
nixpkgs = nixpkgs-25_05;
pkgs = nixpkgs-25_05.legacyPackages.${system};
}
];
testNames = [
"clamav"

View File

@@ -3,7 +3,34 @@
lib,
...
}:
let
mailserverRelease = "25.11";
nixpkgsRelease = lib.trivial.release;
releaseMismatch =
config.mailserver.enableNixpkgsReleaseCheck && mailserverRelease != nixpkgsRelease;
in
{
warnings = lib.optional releaseMismatch ''
You are using
NixOS Mailserver version ${mailserverRelease} and
Nixpkgs version ${nixpkgsRelease}.
Using mismatched versions is likely to cause compatibility issues
and may require migrations that make an eventual rollback tricky.
It is therefore highly recommended to use a release of
NixOS mailserver that corresponds with your chosen release of Nixpkgs.
If you insist then you can disable this warning by adding
mailserver.enableNixpkgsReleaseCheck = false;
to your configuration.
'';
# We guard all assertions by requiring mailserver to be actually enabled
assertions = lib.optionals config.mailserver.enable (
[