mirror of
https://github.com/ordinary-dev/nixos-config.git
synced 2024-09-20 03:40:29 +05:00
Add synapse user and database
This commit is contained in:
parent
8037006825
commit
3b93b3006b
|
@ -3,27 +3,35 @@
|
||||||
config.services.postgresql = {
|
config.services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.postgresql_15;
|
package = pkgs.postgresql_15;
|
||||||
ensureDatabases = [ "mastodon" "synapse" "nextcloud" ];
|
ensureDatabases = [ "mastodon" "matrix-synapse" "nextcloud" ];
|
||||||
ensureUsers = [
|
ensureUsers = [
|
||||||
{
|
{
|
||||||
name = "mastodon";
|
name = "mastodon";
|
||||||
ensurePermissions = {
|
ensurePermissions = {
|
||||||
"DATABASE mastodon" = "ALL PRIVILEGES";
|
"DATABASE mastodon" = "ALL PRIVILEGES";
|
||||||
};
|
};
|
||||||
ensureClauses = {
|
ensureClauses.login = true;
|
||||||
login = true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "nextcloud";
|
name = "nextcloud";
|
||||||
ensurePermissions = {
|
ensurePermissions = {
|
||||||
"DATABASE nextcloud" = "ALL PRIVILEGES";
|
"DATABASE nextcloud" = "ALL PRIVILEGES";
|
||||||
};
|
};
|
||||||
ensureClauses = {
|
ensureClauses.login = true;
|
||||||
login = true;
|
}
|
||||||
|
{
|
||||||
|
name = "matrix-synapse";
|
||||||
|
ensurePermissions = {
|
||||||
|
"DATABASE \"matrix-synapse\"" = "ALL PRIVILEGES";
|
||||||
};
|
};
|
||||||
|
ensureClauses.login = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
initialScript = pkgs.writeText "pg-init.sql" ''
|
||||||
|
ALTER DATABASE nextcloud OWNER TO nextcloud;
|
||||||
|
ALTER DATABASE mastodon OWNER TO mastodon;
|
||||||
|
ALTER DATABASE "matrix-synapse" OWNER TO "matrix-synapse";
|
||||||
|
'';
|
||||||
identMap = ''
|
identMap = ''
|
||||||
# ArbitraryMapName systemUser DBUser
|
# ArbitraryMapName systemUser DBUser
|
||||||
superuser_map root postgres
|
superuser_map root postgres
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "photoprism";
|
group = "photoprism";
|
||||||
};
|
};
|
||||||
|
matrix-synapse = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "matrix-synapse";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
users.groups = {
|
users.groups = {
|
||||||
|
@ -32,5 +36,8 @@
|
||||||
photoprism = {
|
photoprism = {
|
||||||
members = [ "photoprism" config.services.nginx.user ];
|
members = [ "photoprism" config.services.nginx.user ];
|
||||||
};
|
};
|
||||||
|
matrix-synapse = {
|
||||||
|
members = [ "matrix-synapse" config.services.nginx.user ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue