selfprivacy-nixos-config/social/pleroma.nix

52 lines
1.2 KiB
Nix
Raw Normal View History

2021-11-15 12:02:05 +02:00
{ pkgs, config, ... }:
let
cfg = config.services.userdata;
in
{
2022-07-19 15:58:14 +03:00
systemd.services.pleroma.path = [ pkgs.util-linux pkgs.exiftool ];
2021-11-15 12:02:05 +02:00
services = {
pleroma = {
enable = cfg.pleroma.enable;
user = "pleroma";
group = "pleroma";
configs = [
2021-11-18 20:19:26 +02:00
(builtins.replaceStrings
2022-07-14 20:42:42 +03:00
[ "$DOMAIN" "$LUSER" ]
[ cfg.domain cfg.username ]
(builtins.readFile ./config.exs))
2021-11-15 12:02:05 +02:00
];
};
postgresql = {
enable = true;
package = pkgs.postgresql_12;
2022-07-15 18:54:14 +03:00
initialScript = "/etc/setup.psql";
2022-07-14 20:42:42 +03:00
ensureDatabases = [
"pleroma"
];
ensureUsers = [
{
name = "pleroma";
ensurePermissions = {
"DATABASE pleroma" = "ALL PRIVILEGES";
};
2022-07-15 15:27:32 +03:00
}
2022-07-14 20:42:42 +03:00
];
2021-11-15 12:02:05 +02:00
};
};
2022-07-15 18:54:14 +03:00
environment.etc."setup.psql".text = ''
CREATE USER pleroma;
CREATE DATABASE pleroma OWNER pleroma;
\c pleroma;
--Extensions made by ecto.migrate that need superuser access
CREATE EXTENSION IF NOT EXISTS citext;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
'';
2021-11-15 12:02:05 +02:00
users.users.pleroma = {
extraGroups = [ "postgres" ];
2021-11-15 12:29:20 +02:00
isNormalUser = false;
isSystemUser = true;
2022-04-20 13:22:16 +03:00
group = "pleroma";
2021-11-15 12:02:05 +02:00
};
}