add nginx module to flake
This commit is contained in:
parent
2425b4ea14
commit
1acd3aaeda
2 changed files with 47 additions and 0 deletions
|
@ -25,6 +25,7 @@
|
||||||
./system/cerulea-1/networking.nix
|
./system/cerulea-1/networking.nix
|
||||||
./system/base.nix
|
./system/base.nix
|
||||||
./system/software.nix
|
./system/software.nix
|
||||||
|
./system/nginx.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
46
flake/system/nginx.nix
Normal file
46
flake/system/nginx.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{ pkgs, lib, ... }: {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
certbot
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.services.certbot-renew = {
|
||||||
|
description = "certbot auto renew service";
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.certbot}/bin/certbot renew --quiet --post-hook 'systemctl reload nginx.service'";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
systemd.timers.certbot-renew = {
|
||||||
|
description = "certbot auto renew timer";
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "daily";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
user = "root";
|
||||||
|
enableReload = true;
|
||||||
|
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
};
|
||||||
|
services.nginx.appendHttpConfig = "include /srv/ngx/out/*.conf;";
|
||||||
|
|
||||||
|
services.nginx.appendConfig = "user root;";
|
||||||
|
|
||||||
|
systemd.services.nginx.serviceConfig = lib.mkForce {
|
||||||
|
User = "root";
|
||||||
|
Group = "root";
|
||||||
|
ExecStart = "${pkgs.nginx}/bin/nginx -c /etc/nginx/nginx.conf";
|
||||||
|
ExecReload = [
|
||||||
|
"${pkgs.nginx}/bin/nginx -c /etc/nginx/nginx.conf -t"
|
||||||
|
"${pkgs.coreutils}/bin/kill -HUP $MAINPID"
|
||||||
|
];
|
||||||
|
LogsDirectory = "nginx";
|
||||||
|
RuntimeDirectory = "nginx";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue