2024-12-06 21:32:10 +00:00
|
|
|
{ config, ... }:
|
2024-12-03 07:45:11 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
svc_domain = "wger.${config.mine.shared.settings.domain}";
|
2024-12-06 21:32:10 +00:00
|
|
|
port = config.services.wger.port;
|
2024-12-03 07:45:11 +00:00
|
|
|
in {
|
2024-12-06 21:32:10 +00:00
|
|
|
imports = [
|
|
|
|
./wgerpkg/module.nix
|
|
|
|
];
|
2024-12-03 07:45:11 +00:00
|
|
|
|
2024-12-06 21:32:10 +00:00
|
|
|
services.wger = {
|
|
|
|
enable = true;
|
2024-12-03 21:07:03 +00:00
|
|
|
|
2024-12-06 21:32:10 +00:00
|
|
|
configureRedis = true;
|
|
|
|
configurePostgres = true;
|
2024-12-05 16:02:18 +00:00
|
|
|
|
2024-12-06 21:32:10 +00:00
|
|
|
dataDir = config.mine.zfsMounts."rpool/safe/svcs/wger";
|
2024-12-03 21:45:55 +00:00
|
|
|
|
2024-12-06 21:32:10 +00:00
|
|
|
# wger specific settings
|
|
|
|
wgerSettings = {
|
|
|
|
EMAIL_FROM = "wger Workout Manager <wger@${svc_domain}>";
|
2024-12-03 07:45:11 +00:00
|
|
|
};
|
2024-12-03 21:07:03 +00:00
|
|
|
|
2024-12-06 21:32:10 +00:00
|
|
|
# django specific settings
|
|
|
|
djangoSettings = rec {
|
|
|
|
# setup site stuff
|
|
|
|
SITE_URL = "https://${svc_domain}";
|
|
|
|
CSRF_TRUSTED_ORIGINS = [ "https://${svc_domain}" ];
|
|
|
|
ALLOWED_HOSTS = [ svc_domain ];
|
|
|
|
|
|
|
|
# setup email
|
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend";
|
|
|
|
EMAIL_HOST = config.mine.shared.settings.mail.domain_smtp;
|
|
|
|
EMAIL_PORT = config.mine.shared.settings.mail.ports.submissions;
|
|
|
|
EMAIL_USE_SSL = true;
|
|
|
|
EMAIL_HOST_USER = "wger";
|
|
|
|
EMAIL_HOST_PASSWORD = "$EMAIL_HOST_PASSWORD";
|
|
|
|
EMAIL_FROM_ADDRESS = config.services.wger.wgerSettings.EMAIL_FROM;
|
|
|
|
EMAIL_PAGE_DOMAIN = SITE_URL;
|
2024-12-03 21:07:03 +00:00
|
|
|
};
|
2024-12-03 07:45:11 +00:00
|
|
|
};
|
|
|
|
|
2024-12-03 21:07:03 +00:00
|
|
|
# nginx
|
|
|
|
services.nginx.virtualHosts."${svc_domain}" = config.mine.shared.lib.authelia.mkProtectedWebsite {
|
2024-12-03 07:45:11 +00:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
|
|
|
|
locations."/" = config.mine.shared.lib.authelia.mkProtectedLocation {
|
|
|
|
proxyPass = "http://localhost:${builtins.toString port}";
|
|
|
|
};
|
|
|
|
locations."/api/v2/register" = config.mine.shared.lib.authelia.mkProtectedLocation {
|
|
|
|
proxyPass = "http://localhost:${builtins.toString port}";
|
|
|
|
};
|
|
|
|
|
2024-12-06 21:32:10 +00:00
|
|
|
locations."/static".root = "${config.services.wger.package}/share";
|
|
|
|
locations."/media".root = "${config.services.wger.dataDir}";
|
2024-12-03 07:45:11 +00:00
|
|
|
locations."/api".proxyPass = "http://localhost:${builtins.toString port}";
|
|
|
|
};
|
2024-12-03 21:07:03 +00:00
|
|
|
|
|
|
|
# metadata
|
|
|
|
mine.shared.meta.wger = {
|
|
|
|
name = "Wger";
|
|
|
|
description = "We host Wger, which is a FLOSS fitness/workout/nutrition and weight tracker, with FLOSS apps, read more [here](https://wger.de/).";
|
|
|
|
url = "https://${svc_domain}";
|
|
|
|
|
|
|
|
package = let
|
2024-12-06 21:32:10 +00:00
|
|
|
pkg = config.services.wger.package;
|
2024-12-03 21:07:03 +00:00
|
|
|
in {
|
|
|
|
name = pkg.pname;
|
|
|
|
version = pkg.version;
|
|
|
|
meta = pkg.meta;
|
|
|
|
};
|
|
|
|
};
|
2024-12-03 07:45:11 +00:00
|
|
|
}
|