nixos-config/modules/infovhost.nix
Simon Bruder f945341668
Relicense
This applies the REUSE specification to the repository, so the licensing
information can be tracked for every file individually.
2024-01-13 14:35:31 +01:00

39 lines
1,004 B
Nix

# SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ 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;
};
};
}