simple-nixos-fediverse/fediversity/default.nix

110 lines
3.5 KiB
Nix
Raw Normal View History

2024-09-17 17:31:58 +02:00
{ lib, config, ... }:
let
2024-09-17 17:31:58 +02:00
inherit (builtins) toString;
2024-09-20 16:34:08 +02:00
inherit (lib) mkOption mkEnableOption;
inherit (lib.types) types;
in {
imports = [
./garage.nix
./mastodon.nix
./pixelfed.nix
./peertube.nix
];
options = {
fediversity = {
2024-09-20 16:34:08 +02:00
enable = mkEnableOption "the collection of services bundled under Fediversity";
2024-09-17 17:31:58 +02:00
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`.
'';
2024-09-17 17:31:58 +02:00
};
2024-09-20 16:34:08 +02:00
mastodon.enable = mkEnableOption "default Fediversity Mastodon configuration";
pixelfed.enable = mkEnableOption "default Fediversity Pixelfed configuration";
peertube.enable = mkEnableOption "default Fediversity PeerTube configuration";
2024-09-17 17:31:58 +02:00
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}";
};
};
2024-09-17 17:31:58 +02:00
rpc = {
port = mkOption {
type = types.int;
default = 3901;
};
};
2024-09-17 17:31:58 +02:00
web = {
rootDomain = mkOption {
type = types.str;
default = "web.garage.${config.fediversity.domain}";
};
2024-09-23 17:55:54 +02:00
internalPort = mkOption {
type = types.int;
default = 3902;
};
2024-09-24 14:17:56 +02:00
urlForBucket = mkOption {
type = types.functionTo types.str;
2024-09-23 17:55:54 +02:00
default = bucket: "http://${bucket}.${config.fediversity.internal.garage.web.rootDomain}";
};
};
};
## 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}";
};
};
};
2024-09-17 17:31:58 +02:00
};
};
};
2024-09-20 18:51:21 +02:00
config = {
## FIXME: This should clearly go somewhere else; and we should have a
## `staging` vs. `production` setting somewhere.
security.acme = {
acceptTerms = true;
defaults.email = "nicolas.jeannerod+fediversity@moduscreate.com";
# defaults.server = "https://acme-staging-v02.api.letsencrypt.org/directory";
2024-09-20 18:51:21 +02:00
};
};
}