From ff03e75be7101834138b29e6ce3fb7f5e1fb9053 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Sat, 21 Mar 2026 08:40:01 -0400 Subject: [PATCH] syncstorage-rs: add dbBackend argument for PostgreSQL support --- pkgs/by-name/sy/syncstorage-rs/package.nix | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/sy/syncstorage-rs/package.nix b/pkgs/by-name/sy/syncstorage-rs/package.nix index 4a9d103d51b6..e88bcb030869 100644 --- a/pkgs/by-name/sy/syncstorage-rs/package.nix +++ b/pkgs/by-name/sy/syncstorage-rs/package.nix @@ -6,10 +6,13 @@ python3, cmake, libmysqlclient, + libpq, + openssl, makeBinaryWrapper, lib, nix-update-script, nixosTests, + dbBackend ? "mysql", }: let @@ -46,9 +49,26 @@ rustPlatform.buildRustPackage (finalAttrs: { python3 ]; - buildInputs = [ - libmysqlclient - ]; + buildInputs = + lib.optional (dbBackend == "mysql") libmysqlclient + ++ lib.optionals (dbBackend == "postgresql") [ + libpq + openssl + ]; + + buildNoDefaultFeatures = true; + # The syncserver "postgres" feature only enables syncstorage-db/postgres. + # tokenserver-db/postgres must be enabled separately so the tokenserver + # can also connect to PostgreSQL (it dispatches on the URL scheme at runtime). + buildFeatures = + let + cargoFeature = if dbBackend == "postgresql" then "postgres" else dbBackend; + in + [ + cargoFeature + "tokenserver-db/${cargoFeature}" + "py_verifier" + ]; env = { SWAGGER_UI_DOWNLOAD_URL = "file://${swaggerUi}";