Add static-website service
This commit is contained in:
parent
ede1eb9c51
commit
2ca5ba1718
2 changed files with 35 additions and 0 deletions
9
hosts/hackens-org/modules/nginx.nix
Normal file
9
hosts/hackens-org/modules/nginx.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.nginx = {
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
};
|
||||||
|
}
|
26
hosts/hackens-org/modules/static-website.nix
Normal file
26
hosts/hackens-org/modules/static-website.nix
Normal 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
|
||||||
|
*/
|
Loading…
Reference in a new issue