nixos/kanidm: set default package version based on stateVersion

This commit is contained in:
Adam C. Stephens 2024-12-03 15:33:05 +00:00
parent dda17ad20c
commit 90840cdb05
No known key found for this signature in database

View File

@ -231,7 +231,10 @@ in
enableServer = mkEnableOption "the Kanidm server";
enablePam = mkEnableOption "the Kanidm PAM and NSS integration";
package = mkPackageOption pkgs "kanidm" { };
package = mkPackageOption pkgs "kanidm" {
example = "kanidm_1_4";
extraDescription = "If not set will receive a specific version based on stateVersion. Set to `pkgs.kanidm` to always receive the latest version, with the understanding that this could introduce breaking changes.";
};
serverSettings = mkOption {
type = types.submodule {
@ -811,6 +814,16 @@ in
)
);
services.kanidm.package =
let
pkg =
if lib.versionAtLeast config.system.stateVersion "24.11" then
pkgs.kanidm_1_4
else
lib.warn "No default kanidm package found for stateVersion = '${config.system.stateVersion}'. Using unpinned version. Consider setting `services.kanidm.package = pkgs.kanidm_1_x` to avoid upgrades introducing breaking changes." pkgs.kanidm;
in
lib.mkDefault pkg;
environment.systemPackages = mkIf cfg.enableClient [ cfg.package ];
systemd.tmpfiles.settings."10-kanidm" = {