2024-01-06 01:19:35 +01:00
|
|
|
# SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2024-01-03 12:04:26 +01:00
|
|
|
{ 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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|