1
0
Fork 0

add(acme,nginx): add certificate generation and nginx for the services

This replaces caddy and the port exposure, this is more efficent and
easier to manage in the future.
This commit is contained in:
Philipp 2025-05-25 00:32:54 +02:00
parent 7dd87536aa
commit 5792e478af
Signed by: Philipp
GPG key ID: 9EBD8439AFBAB750
9 changed files with 244 additions and 74 deletions

View file

@ -13,6 +13,13 @@ in
{
options.${namespace}.services.forgejo = {
enable = mkEnableOption "Forgejo";
nginx = {
enable = mkEnableOption {
description = "Enable nginx for this service.";
type = types.bool;
default = true;
};
};
package = mkOption {
description = "The package of Forgejo to use.";
@ -29,13 +36,13 @@ in
domain = mkOption {
description = "The domain to serve Forgejo on.";
type = types.nullOr types.str;
default = "git.monapona.dev";
default = "git.stahl.sh";
};
ssh_domain = mkOption {
description = "The domain to serve Forgejo on.";
type = types.nullOr types.str;
default = "monapona.dev";
default = "stahl.sh";
};
user = mkOption {
@ -47,7 +54,8 @@ in
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [
cfg.port
80
443
];
systemd.services.codeberg-themes = {
@ -78,7 +86,7 @@ in
server = {
DOMAIN = cfg.domain;
HTTP_PORT = cfg.port;
ROOT_URL = "https://git.monapona.dev";
ROOT_URL = "https://" + cfg.domain;
SSH_DOMAIN = cfg.ssh_domain;
};
ui = {
@ -87,5 +95,17 @@ in
};
};
};
awesome-flake.services.acme.enable = mkIf cfg.nginx.enable true;
services.nginx = mkIf cfg.nginx.enable {
enable = true;
virtualHosts."${cfg.domain}" = {
forceSSL = true;
useACMEHost = "stahl.sh";
locations."/".proxyPass = "http://127.0.0.1:${builtins.toString cfg.port}";
};
};
};
}