2024-11-20 18:19:27 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2024-08-13 11:47:14 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
urlpath = "/members";
|
|
|
|
metaJSONFile = (pkgs.formats.json {}).generate "meta-service-info.json" config.mine.shared.meta;
|
|
|
|
port = 5050;
|
|
|
|
in {
|
|
|
|
systemd.services.website-member = {
|
|
|
|
description = "members area website";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "networking.target" ];
|
2025-01-02 16:18:31 +00:00
|
|
|
|
|
|
|
environment = {
|
|
|
|
AUTH_PROXY_USERNAME = config.mine.shared.lib.authelia.protectedHeaders.username;
|
|
|
|
AUTH_PROXY_GROUPS = config.mine.shared.lib.authelia.protectedHeaders.groups;
|
|
|
|
AUTH_PROXY_EMAIL = config.mine.shared.lib.authelia.protectedHeaders.email;
|
|
|
|
AUTH_PROXY_NAME = config.mine.shared.lib.authelia.protectedHeaders.name;
|
|
|
|
};
|
|
|
|
|
2024-08-13 11:47:14 +00:00
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = let
|
|
|
|
pythonEnv = pkgs.python3.withPackages(ps: with ps; [ flask ]);
|
|
|
|
in "${pythonEnv}/bin/python ${./app.py} --port ${builtins.toString port} --meta-json ${metaJSONFile}";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."${config.mine.shared.settings.domain}" = config.mine.shared.lib.authelia.mkProtectedWebsite {
|
2024-12-03 21:06:04 +00:00
|
|
|
locations."${urlpath}" = config.mine.shared.lib.authelia.mkProtectedLocation {
|
2024-08-13 11:47:14 +00:00
|
|
|
proxyPass = "http://localhost:${builtins.toString port}";
|
|
|
|
};
|
|
|
|
};
|
2024-11-20 18:19:27 +00:00
|
|
|
|
|
|
|
mine.shared.meta.website-members = {
|
|
|
|
name = "Members Website";
|
|
|
|
description = "This website you are looking at right now, which is our members website.";
|
|
|
|
url = "https://${config.mine.shared.settings.domain}${urlpath}";
|
|
|
|
|
|
|
|
package = {
|
|
|
|
name = "members-website";
|
|
|
|
version = "v0.0.1";
|
|
|
|
meta = with lib; {
|
2024-11-20 18:22:37 +00:00
|
|
|
description = "Members website for ${config.mine.shared.settings.domain}";
|
2024-11-20 18:19:27 +00:00
|
|
|
license = licenses.free;
|
|
|
|
homepage = "https://git.fricloud.dk/fricloud/server-configs/src/branch/main/machines/gerd/services/member-website/app.py";
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-08-13 11:47:14 +00:00
|
|
|
}
|