fruitbasket/modules/course-management.nix

54 lines
1.4 KiB
Nix
Raw Normal View History

2023-06-08 13:34:45 +02:00
{ config, lib, pkgs, ... }:
let
# hostName = "kurse.${config.fsr.domain}";
hostName = "kurse.ifsr.de";
2023-06-08 13:34:45 +02:00
in
{
sops.secrets =
let inherit (config.services.course-management) user;
2023-07-19 15:46:49 +02:00
in
{
2023-06-08 13:34:45 +02:00
"course-management/secret-key".owner = user;
"course-management/adminpass".owner = user;
};
2023-08-21 12:10:44 +02:00
systemd.services.course-management.after = [ "postgresql.service" ];
2023-06-08 13:34:45 +02:00
services.course-management = {
inherit hostName;
enable = true;
settings = {
secretKeyFile = config.sops.secrets."course-management/secret-key".path;
adminPassFile = config.sops.secrets."course-management/adminpass".path;
admins = [{
name = "Root iFSR";
email = "root@${config.fsr.domain}";
}];
database = {
ENGINE = "django.db.backends.postgresql";
NAME = "course-management";
};
email = lib.mkDefault {
fromEmail = "noreply@${config.fsr.domain}";
serverEmail = "root@${config.fsr.domain}";
};
};
};
services.postgresql = {
2023-07-19 15:46:49 +02:00
enable = lib.mkForce true; # upstream bacula config wants to disable it, so we need to force
2023-06-08 13:34:45 +02:00
ensureUsers = [{
name = "course-management";
ensurePermissions = {
"DATABASE \"course-management\"" = "ALL PRIVILEGES";
};
}];
ensureDatabases = [ "course-management" ];
};
services.nginx.virtualHosts.${hostName} = {
enableACME = true;
forceSSL = true;
};
}