2022-12-22 21:58:24 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
2022-12-22 22:01:28 +01:00
|
|
|
let
|
2022-12-22 21:58:24 +01:00
|
|
|
cfg = config.services.portunus;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.portunus = {
|
|
|
|
externalIp4 = lib.mkOption {
|
|
|
|
type = with lib.types; nullOr str;
|
|
|
|
default = null;
|
|
|
|
description = lib.mdDoc "Internal IPv4 of portunus instance. This is used in the addToHosts option.";
|
|
|
|
};
|
|
|
|
|
|
|
|
externalIp6 = lib.mkOption {
|
|
|
|
type = with lib.types; nullOr str;
|
|
|
|
default = null;
|
|
|
|
description = lib.mdDoc "Internal IPv6 of portunus instance. This is used in the addToHosts option.";
|
|
|
|
};
|
|
|
|
|
|
|
|
addToHosts = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
description = lib.mdDoc "Wether to add a hosts entry for the portunus domain pointing to externalIp";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-12-24 15:37:44 +01:00
|
|
|
config.networking.hosts = lib.mkIf cfg.addToHosts {
|
|
|
|
${cfg.externalIp4} = [ cfg.domain ];
|
|
|
|
${cfg.externalIp6} = [ cfg.domain ];
|
2022-12-22 21:58:24 +01:00
|
|
|
};
|
|
|
|
}
|