nixos/modules/locations.nix

51 lines
1.2 KiB
Nix
Raw Normal View History

2023-04-29 19:20:42 +01:00
{ config, lib, ... }:
let
cfg = config.custom.locations;
in
{
options.custom.locations = {
autoServe = lib.mkOption {
default = false;
type = lib.types.bool;
};
locations = lib.mkOption {
2024-04-27 17:06:20 +01:00
readOnly = true;
};
};
config = lib.mkMerge [
{
custom.locations.locations = {
2023-04-29 19:20:42 +01:00
services = {
2024-05-21 22:38:26 +01:00
authoritative_dns = [ "boron.cx.ts.hillion.co.uk" ];
downloads = "tywin.storage.ts.hillion.co.uk";
2024-05-12 11:33:08 +01:00
gitea = "boron.cx.ts.hillion.co.uk";
2023-12-24 22:09:53 +00:00
homeassistant = "microserver.home.ts.hillion.co.uk";
2024-04-07 19:06:46 +01:00
mastodon = "";
2024-05-18 18:52:16 +01:00
matrix = "boron.cx.ts.hillion.co.uk";
2024-04-22 20:49:43 +01:00
tang = [
"li.pop.ts.hillion.co.uk"
"microserver.home.ts.hillion.co.uk"
];
2024-05-18 16:41:53 +01:00
unifi = "boron.cx.ts.hillion.co.uk";
2024-05-21 22:38:26 +01:00
version_tracker = [ "boron.cx.ts.hillion.co.uk" ];
2023-04-29 19:20:42 +01:00
};
};
}
2023-04-29 19:20:42 +01:00
(lib.mkIf cfg.autoServe
{
custom.services = lib.mapAttrsRecursive
(path: value: {
enable =
if builtins.isList value
then builtins.elem config.networking.fqdn value
else config.networking.fqdn == value;
})
cfg.locations.services;
2024-04-27 17:06:20 +01:00
})
];
2023-04-29 19:20:42 +01:00
}