mirror of
https://github.com/SuperSandro2000/nixos-modules.git
synced 2024-06-11 18:54:06 +02:00
portunus: add option to create hosts entries
This commit is contained in:
parent
1f173f875c
commit
2fa64e5ee1
32
modules/portunus.nix
Normal file
32
modules/portunus.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.portunus.addToHosts {
|
||||
networking.hosts = {
|
||||
${cfg.externalIp4} = [ cfg.domain ];
|
||||
${cfg.externalIp6} = [ cfg.domain ];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user