nginx: use acme certs

This commit is contained in:
Zynh Ludwig 2024-12-27 07:12:57 -08:00
parent 0a6f5ef0e3
commit 44251ccf66
3 changed files with 9 additions and 3 deletions

View file

@ -2,6 +2,7 @@
let let
cfg = config.permafrost.nyazoom; cfg = config.permafrost.nyazoom;
ACMEEnabled = config.nginx.enableACME;
in in
{ {
options.permafrost.nyazoom = { options.permafrost.nyazoom = {
@ -10,10 +11,11 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
permafrost.nginx.enable = lib.mkDefault true; permafrost.nginx.enable = lib.mkDefault true;
permafrost.nginx.certDomains = [ "git.zynh.me" ]; permafrost.nginx.certDomains = lib.mkIf ACMEEnabled [ "git.zynh.me" ];
services.nginx.virtualHosts."git.zynh.me" = { services.nginx.virtualHosts."git.zynh.me" = {
addSSL = true; addSSL = true;
serverName = "git.zynh.me"; serverName = "git.zynh.me";
useACMEHost = lib.mkIf ACMEEnabled "scarlet.zynh.me";
locations."/" = { locations."/" = {
proxyPass = "http://localhost:3032"; proxyPass = "http://localhost:3032";
}; };

View file

@ -2,6 +2,7 @@
let let
cfg = config.permafrost.foundry; cfg = config.permafrost.foundry;
ACMEEnabled = config.nginx.enableACME;
in in
{ {
options.permafrost.foundry = { options.permafrost.foundry = {
@ -10,10 +11,11 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
permafrost.nginx.enable = lib.mkDefault true; permafrost.nginx.enable = lib.mkDefault true;
permafrost.nginx.certDomains = [ "scarlet.zynh.me" ]; permafrost.nginx.certDomains = lib.mkIf ACMEEnabled [ "scarlet.zynh.me" ];
services.nginx.virtualHosts."scarlet.zynh.me" = { services.nginx.virtualHosts."scarlet.zynh.me" = {
addSSL = true; addSSL = true;
serverName = "scarlet.zynh.me"; serverName = "scarlet.zynh.me";
useACMEHost = lib.mkIf ACMEEnabled "scarlet.zynh.me";
locations."/" = { locations."/" = {
extraConfig = /* nginx */ '' extraConfig = /* nginx */ ''
# Set proxy headers # Set proxy headers

View file

@ -4,6 +4,7 @@ let
nyazoom = inputs.nyazoom.packages.${pkgs.system}.default; nyazoom = inputs.nyazoom.packages.${pkgs.system}.default;
cfg = config.permafrost.nyazoom; cfg = config.permafrost.nyazoom;
ACMEEnabled = config.nginx.enableACME;
in in
{ {
options.permafrost.nyazoom = { options.permafrost.nyazoom = {
@ -22,10 +23,11 @@ in
}; };
permafrost.nginx.enable = lib.mkDefault true; permafrost.nginx.enable = lib.mkDefault true;
permafrost.nginx.certDomains = [ "nyazoom.zynh.me" ]; permafrost.nginx.certDomains = lib.mkIf ACMEEnabled [ "nyazoom.zynh.me" ];
services.nginx.virtualHosts."nyazoom.zynh.me" = { services.nginx.virtualHosts."nyazoom.zynh.me" = {
addSSL = true; addSSL = true;
serverName = "nyazoom.zynh.me"; serverName = "nyazoom.zynh.me";
useACMEHost = lib.mkIf ACMEEnabled "scarlet.zynh.me";
locations."/" = { locations."/" = {
proxyPass = "http://localhost:3000"; proxyPass = "http://localhost:3000";
extraConfig = /* nginx */ '' extraConfig = /* nginx */ ''