Skip to content

Commit

Permalink
nixos/garage: add assertion for replication_factor
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-re-ka committed May 13, 2024
1 parent 8950e22 commit aa64bb2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions nixos/modules/services/web-servers/garage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ in
};

config = mkIf cfg.enable {

assertions = [
# We removed our module-level default for replication_mode. If a user upgraded
# to garage 1.0.0 while relying on the module-level default, they would be left
# with a config which evaluates and builds, but then garage refuses to start
# because either replication_factor or replication_mode is required.
# This assertion can be removed in NixOS 24.11, when all users have been warned once.
{
assertion = (cfg.settings ? replication_factor || cfg.settings ? replication_mode) || lib.versionOlder cfg.package "1.0.0";
message = ''
Garage 1.0.0 requires an explicit replication factor to be set.
Please set replication_factor to 1 explicitly to preserve the previous behavior.
https://git.deuxfleurs.fr/Deuxfleurs/garage/src/tag/v1.0.0/doc/book/reference-manual/configuration.md#replication_factor
'';
}
];

environment.etc."garage.toml" = {
source = configFile;
};
Expand Down

0 comments on commit aa64bb2

Please sign in to comment.