aboutsummaryrefslogtreecommitdiff
path: root/modules/services/fediverse
diff options
context:
space:
mode:
Diffstat (limited to 'modules/services/fediverse')
-rw-r--r--modules/services/fediverse/default.nix67
1 files changed, 48 insertions, 19 deletions
diff --git a/modules/services/fediverse/default.nix b/modules/services/fediverse/default.nix
index 0c3c696..b67cdcc 100644
--- a/modules/services/fediverse/default.nix
+++ b/modules/services/fediverse/default.nix
@@ -1,26 +1,55 @@
-{ pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib;
let
- domain = "social.tdback.net";
- port = 8080;
+ cfg = config.modules.services.fediverse;
in
{
- services.gotosocial = {
- enable = true;
- package = pkgs.unstable.gotosocial;
- settings = {
- application-name = "gotosocial";
- host = "${domain}";
- protocol = "https";
- bind-address = "localhost";
- port = port;
- db-type = "sqlite";
- db-address = "/var/lib/gotosocial/database.sqlite";
- storage-local-base-path = "/var/lib/gotosocial/storage";
+ options.modules.services.fediverse = {
+ enable = mkEnableOption "fediverse";
+ package = mkPackageOption pkgs "gotosocial" { };
+ port = mkOption {
+ default = 8080;
+ type = types.int;
+ };
+ url = mkOption {
+ type = types.str;
};
};
- services.caddy.virtualHosts.${domain}.extraConfig = ''
- encode zstd gzip
- reverse_proxy http://localhost:${builtins.toString port}
- '';
+ config = mkIf cfg.enable {
+ networking.firewall.allowedTCPPorts = [
+ 80
+ 443
+ ];
+
+ services.caddy = {
+ enable = true;
+ virtualHosts = {
+ ${cfg.url}.extraConfig = ''
+ encode zstd gzip
+ reverse_proxy http://localhost:${builtins.toString cfg.port}
+ '';
+ };
+ };
+
+ services.gotosocial = {
+ enable = true;
+ package = cfg.package;
+ settings = {
+ application-name = "gotosocial";
+ bind-address = "localhost";
+ port = cfg.port;
+ host = cfg.url;
+ protocol = "https";
+ db-type = "sqlite";
+ db-address = "/var/lib/gotosocial/database.sqlite";
+ storage-local-base-path = "/var/lib/gotosocial/storage";
+ };
+ };
+ };
}