35 lines
893 B
Nix
35 lines
893 B
Nix
|
{ config, lib, pkgs, ... }:
|
||
|
let
|
||
|
cfg = config.sbruder.infovhost;
|
||
|
in
|
||
|
{
|
||
|
options.sbruder.infovhost = {
|
||
|
enable = lib.mkEnableOption "a vhost displaying legal and/or technical information on the domain of the machine";
|
||
|
domain = lib.mkOption {
|
||
|
type = lib.types.str;
|
||
|
default =
|
||
|
if (!(isNull config.networking.domain))
|
||
|
then config.networking.domain
|
||
|
else "sbruder.de";
|
||
|
description = "The domain part of the fqdn.";
|
||
|
};
|
||
|
fqdn = lib.mkOption {
|
||
|
type = lib.types.str;
|
||
|
default = "${config.networking.hostName}.${cfg.domain}";
|
||
|
description = "The fqdn the vhost should listen on.";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = lib.mkIf cfg.enable {
|
||
|
services.nginx.enable = true;
|
||
|
services.nginx.virtualHosts."${cfg.fqdn}" = {
|
||
|
enableACME = true;
|
||
|
forceSSL = true;
|
||
|
|
||
|
default = true;
|
||
|
|
||
|
root = pkgs.sbruder.imprint;
|
||
|
};
|
||
|
};
|
||
|
}
|