Skip to content

Commit 40063ae

Browse files
committed
syncstorage-rs: add dbBackend argument for PostgreSQL support
1 parent 521bc60 commit 40063ae

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

pkgs/by-name/sy/syncstorage-rs/package.nix

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
python3,
77
cmake,
88
libmysqlclient,
9+
libpq,
10+
openssl,
911
makeBinaryWrapper,
1012
lib,
1113
nix-update-script,
1214
nixosTests,
15+
dbBackend ? "mysql",
1316
}:
1417

1518
let
@@ -46,9 +49,26 @@ rustPlatform.buildRustPackage (finalAttrs: {
4649
python3
4750
];
4851

49-
buildInputs = [
50-
libmysqlclient
51-
];
52+
buildInputs =
53+
lib.optional (dbBackend == "mysql") libmysqlclient
54+
++ lib.optionals (dbBackend == "postgresql") [
55+
libpq
56+
openssl
57+
];
58+
59+
buildNoDefaultFeatures = true;
60+
# The syncserver "postgres" feature only enables syncstorage-db/postgres.
61+
# tokenserver-db/postgres must be enabled separately so the tokenserver
62+
# can also connect to PostgreSQL (it dispatches on the URL scheme at runtime).
63+
buildFeatures =
64+
let
65+
cargoFeature = if dbBackend == "postgresql" then "postgres" else dbBackend;
66+
in
67+
[
68+
cargoFeature
69+
"tokenserver-db/${cargoFeature}"
70+
"py_verifier"
71+
];
5272

5373
env = {
5474
SWAGGER_UI_DOWNLOAD_URL = "file://${swaggerUi}";

0 commit comments

Comments
 (0)