From e2bbc6fb469a43384b593f3018920a0f2a090a5e Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Thu, 16 May 2019 15:05:32 -0500 Subject: [PATCH] nixos: fix services.foundationdb.traceFormat for older server versions This was a testing oversight that came from #61009 -- I forgot to test the new traceFormat option with older server versions while I was working on FDB 6.1. Since trace_format is only available in 6.1+, emitting it unconditionally caused older versions of the database fail to start, reporting an error. We simply gate it behind a version check instead, and assert the format is always XML on older versions. This avoids the case where the user has an old version, changes traceFormat willingly, and then is confused by why it didn't work. As reported by @TimothyKlim in the comments on commit c55b9236f0f208a8689e400ddbea52858c923372. See https://github.com/NixOS/nixpkgs/commit/c55b9236f0f208a8689e400ddbea52858c923372#r33566132 Signed-off-by: Austin Seipp --- nixos/modules/services/databases/foundationdb.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/modules/services/databases/foundationdb.nix b/nixos/modules/services/databases/foundationdb.nix index 169ed37b348e..490c5e9d005a 100644 --- a/nixos/modules/services/databases/foundationdb.nix +++ b/nixos/modules/services/databases/foundationdb.nix @@ -35,7 +35,10 @@ let ${optionalString (cfg.class != null) "class = ${cfg.class}"} memory = ${cfg.memory} storage_memory = ${cfg.storageMemory} + + ${optionalString (lib.versionAtLeast cfg.package.version "6.1") '' trace_format = ${cfg.traceFormat} + ''} ${optionalString (cfg.tls != null) '' tls_plugin = ${pkg}/libexec/plugins/FDBLibTLS.so @@ -327,6 +330,15 @@ in }; config = mkIf cfg.enable { + assertions = [ + { assertion = lib.versionOlder cfg.package.version "6.1" -> cfg.traceFormat == "xml"; + message = '' + Versions of FoundationDB before 6.1 do not support configurable trace formats (only XML is supported). + This option has no effect for version '' + cfg.package.version + '', and enabling it is an error. + ''; + } + ]; + environment.systemPackages = [ pkg ]; users.users = optionalAttrs (cfg.user == "foundationdb") (singleton