forked from Fediversity/simple-nixos-fediverse
104 lines
3.4 KiB
Nix
104 lines
3.4 KiB
Nix
{ 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";
|
|
|
|
domain = mkOption {
|
|
type = types.str;
|
|
description = ''
|
|
root domain for the Fediversity services
|
|
|
|
For instance, if this option is set to `foo.example.com`, then
|
|
Pixelfed might be under `pixelfed.foo.example.com`.
|
|
'';
|
|
};
|
|
|
|
mastodon.enable = mkEnableOption "default Fediversity Mastodon configuration";
|
|
pixelfed.enable = mkEnableOption "default Fediversity Pixelfed configuration";
|
|
peertube.enable = mkEnableOption "default Fediversity PeerTube configuration";
|
|
|
|
internal = mkOption {
|
|
description = "options that are only meant to be used internally; change at your own risk";
|
|
default = {};
|
|
type = types.submodule {
|
|
options = {
|
|
garage = {
|
|
api = {
|
|
domain = mkOption {
|
|
type = types.str;
|
|
default = "s3.garage.${config.fediversity.domain}";
|
|
};
|
|
port = mkOption {
|
|
type = types.int;
|
|
default = 3900;
|
|
};
|
|
url = mkOption {
|
|
type = types.str;
|
|
default = "http://${config.fediversity.internal.garage.api.domain}:${toString config.fediversity.internal.garage.api.port}";
|
|
};
|
|
};
|
|
|
|
rpc = {
|
|
port = mkOption {
|
|
type = types.int;
|
|
default = 3901;
|
|
};
|
|
};
|
|
|
|
web = {
|
|
rootDomain = mkOption {
|
|
type = types.str;
|
|
default = "web.garage.${config.fediversity.domain}";
|
|
};
|
|
port = mkOption {
|
|
type = types.int;
|
|
default = 3902;
|
|
};
|
|
rootDomainAndPort = mkOption {
|
|
type = types.str;
|
|
default = "${config.fediversity.internal.garage.web.rootDomain}:${toString config.fediversity.internal.garage.web.port}";
|
|
};
|
|
urlFor = mkOption {
|
|
type = types.functionTo types.str;
|
|
default = bucket: "http://${bucket}.${config.fediversity.internal.garage.web.rootDomainAndPort}";
|
|
};
|
|
};
|
|
};
|
|
|
|
## REVIEW: Do we want to recreate options under
|
|
## `fediversity.internal` or would we rather use the options from
|
|
## the respective services? See Taeer's comment:
|
|
## https://git.fediversity.eu/taeer/simple-nixos-fediverse/pulls/22#issuecomment-124
|
|
pixelfed.domain = mkOption {
|
|
type = types.str;
|
|
default = "pixelfed.${config.fediversity.domain}";
|
|
};
|
|
mastodon.domain = mkOption {
|
|
type = types.str;
|
|
default = "mastdodon.${config.fediversity.domain}";
|
|
};
|
|
peertube.domain = mkOption {
|
|
type = types.str;
|
|
default = "peertube.${config.fediversity.domain}";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|