aux-config/modules/nixos/services/traefik-proxy/default.nix
kB01 8a73af6a7c
All checks were successful
/ Check Nix Flake (push) Successful in 2m4s
Added NAS Suite
2025-02-22 02:45:49 +01:00

53 lines
1.2 KiB
Nix

{ inputs, config, lib, pkgs, ... }:
let
cfg = config.services.traefik-proxy;
in
{
imports = [
];
options.services.traefik-proxy = {
enable = lib.mkOption {
type = with lib.types; uniq bool;
default = false;
description = "Enable Pre-Configured Traefik Proxy";
};
};
config = lib.mkIf (cfg.enable ||
config.services.binary-cache.enable ||
config.suites.nas.media.enable) {
services.traefik = {
enable = true;
staticConfigOptions = {
entryPoints = {
web = {
address = ":80";
asDefault = true;
http.redirections.entrypoint = {
to = "websecure";
scheme = "https";
};
};
websecure = {
address = ":443";
asDefault = true;
http.tls.certResolver = "letsencrypt";
};
};
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
# Configure Letsencrypt
services.traefik.staticConfigOptions = {
certificatesResolvers.letsencrypt.acme = {
email = "kb01@kb-one.de";
tlsChallenge = {};
storage = "/var/secrets/traefik/acme.json";
};
};
};
}