Add static-website service

This commit is contained in:
gabriel-doriath-dohler 2021-12-14 21:21:03 +01:00
parent ede1eb9c51
commit 2ca5ba1718
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,9 @@
{ ... }:
{
services.nginx = {
recommendedTlsSettings = true;
recommendedProxySettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
};
}

View file

@ -0,0 +1,26 @@
{ lib, config }:
with lib;
let
cfg = config.services.static-website.config;
l = builtins.split cfg.name "/";
name = lists.last l;
in
{
services.static-website.config = lib.mkOption {
type = with types; attrsOf (submodule {
options.name = mkOption path;
});
};
config = {
services.nginx.enable = cfg.enable;
virtualHosts."${cfg.name}" = {
root = "/var/lib/nginx/static/${name}";
}
};
}
/* TODO
ACME
*/