nixos/synapse: add option to configure redis automatically

This commit is contained in:
Sophie Tauchert 2023-07-06 23:03:51 +02:00
parent b7c41da8d6
commit b329180128
No known key found for this signature in database
GPG Key ID: 52701DE5F5F51125

View File

@ -770,6 +770,14 @@ in {
NixOps is in use.
'';
};
configureRedisLocally = lib.mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Whether to automatically configure a local redis server for matrix-synapse.
'';
};
};
};
@ -794,6 +802,11 @@ in {
}
];
services.matrix-synapse.settings.redis = lib.mkIf cfg.configureRedisLocally {
enabled = true;
path = config.services.redis.servers.matrix-synapse.unixSocket;
};
services.matrix-synapse.configFile = configFile;
services.matrix-synapse.package = wrapped;
@ -886,6 +899,11 @@ in {
];
};
services.redis.servers.matrix-synapse = lib.mkIf cfg.configureRedisLocally {
enable = true;
user = "matrix-synapse";
};
environment.systemPackages = [ registerNewMatrixUser ];
};