{ lib, config, ... }: let inherit (builtins) toString; inherit (lib) mkOption; inherit (lib.types) types; in { imports = [ ./garage.nix ./mastodon.nix ./pixelfed.nix ./peertube.nix ]; options = { fediversity = { enable = mkOption { type = types.bool; default = false; }; garage = mkOption { type = types.anything; }; domain = mkOption { type = types.string; }; mastodon.enable = mkOption { type = types.bool; default = false; }; pixelfed.enable = mkOption { type = types.bool; default = false; }; peertube.enable = mkOption { type = types.bool; default = false; }; }; }; config.fediversity = { garage = { api = rec { domain = "s3.garage.${config.fediversity.domain}"; port = 3900; url = "http://${domain}:${toString port}"; }; rpc = rec { port = 3901; }; web = rec { rootDomain = "web.garage.${config.fediversity.domain}"; port = 3902; rootDomainAndPort = "${rootDomain}:${toString port}"; urlFor = bucket: "http://${bucket}.${rootDomainAndPort}"; }; }; pixelfed.domain = "pixelfed.${config.fediversity.domain}"; mastodon.domain = "mastdodon.${config.fediversity.domain}"; peertube.domain = "peertube.${config.fediversity.domain}"; }; }