{ lib, config, ... }: let inherit (builtins) toString; inherit (lib) mkOption mkEnableOption; inherit (lib.types) types; in { imports = [ ./garage.nix ./mastodon.nix ./pixelfed.nix ./peertube.nix ]; options = { fediversity = { enable = mkEnableOption "the collection of services bundled under Fediversity"; garage = mkOption { type = types.anything; }; domain = mkOption { type = types.string; }; mastodon.enable = mkEnableOption "default Fediversity Mastodon configuration"; pixelfed.enable = mkEnableOption "default Fediversity Pixelfed configuration"; peertube.enable = mkEnableOption "default Fediversity PeerTube configuration"; }; }; 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}"; }; }