about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-05-15 11:48:25 +0200
committerFlorian Klink <flokli@flokli.de>2024-05-15 11:48:25 +0200
commit24ace2abee4d9ae78cb79d3dc82cf7439d067bb2 (patch)
treeca7ac2af6f323cc98336ddb274a0f6e421c7a236 /nixos
parent1284b4f7fa36a3e4e7f05a979f56136277ac8983 (diff)
nixos/garage: assert that replication_mode is string
The explicit `replication_mode` option in `services.garage.settings`
has been removed and is now handled by the freeform settings in order
to allow it being completely absent (for Garage 1.x).
That module option previously `toString`'ed the value it's configured
with, which is now no longer possible.
Warn the user if they're still using a non-string here.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-servers/garage.nix22
1 files changed, 21 insertions, 1 deletions
diff --git a/nixos/modules/services/web-servers/garage.nix b/nixos/modules/services/web-servers/garage.nix
index f75829d64d67c..d2a5109e266a9 100644
--- a/nixos/modules/services/web-servers/garage.nix
+++ b/nixos/modules/services/web-servers/garage.nix
@@ -70,7 +70,11 @@ in
       # 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.
+      # The replication_factor option also was `toString`'ed before, which is
+      # now not possible anymore, so we prompt the user to change it to a string
+      # if present.
+      # These assertions 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 = ''
@@ -80,6 +84,22 @@ in
 
         '';
       }
+      {
+        assertion = lib.isString (cfg.settings.replication_mode or "");
+        message = ''
+          The explicit `replication_mode` option in `services.garage.settings`
+          has been removed and is now handled by the freeform settings in order
+          to allow it being completely absent (for Garage 1.x).
+          That module option previously `toString`'ed the value it's configured
+          with, which is now no longer possible.
+
+          You're still using a non-string here, please manually set it to
+          a string, or migrate to the separate setting keys introduced in 1.x.
+
+          Refer to https://garagehq.deuxfleurs.fr/documentation/working-documents/migration-1/
+          for the migration guide.
+        '';
+      }
     ];
 
     environment.etc."garage.toml" = {