infrastructure/modules/nixos/access.nix
2024-01-15 11:05:07 -08:00

27 lines
657 B
Nix

{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption;
inherit (config.networking) hostName;
in {
options.networking.access = with lib.types; {
static.ipv4 = mkOption {
type = str;
};
hostnameForNetwork = mkOption {
type = attrsOf str;
default = { };
};
};
config.networking.access = {
hostnameForNetwork = {
local = mkIf config.services.avahi.enable "${hostName}.local.gensokyo.zone";
tail = mkIf config.services.tailscale.enable "${hostName}.tail.gensokyo.zone";
global = mkIf config.networking.enableIPv6 "${hostName}.gensokyo.zone";
};
};
}