about summary refs log tree commit diff
path: root/nixos/modules/services/web-servers
diff options
context:
space:
mode:
authorYureka <yuka@yuka.dev>2024-05-13 09:18:19 +0200
committerYureka <yuka@yuka.dev>2024-05-13 10:03:21 +0200
commitaa64bb27bab9ec06de96d92a41dbeafc8e4d732f (patch)
tree5a0bffb920a6d312587950560a0fa0afe916ca69 /nixos/modules/services/web-servers
parent8950e22d8cb1c554b730633bd197c3990979033f (diff)
nixos/garage: add assertion for replication_factor
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r--nixos/modules/services/web-servers/garage.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/services/web-servers/garage.nix b/nixos/modules/services/web-servers/garage.nix
index 24794651bb933..f75829d64d67c 100644
--- a/nixos/modules/services/web-servers/garage.nix
+++ b/nixos/modules/services/web-servers/garage.nix
@@ -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;
     };