aboutsummaryrefslogtreecommitdiffstats
path: root/modules/vhack/pe/peertube
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-30 14:05:39 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-30 14:05:39 +0200
commitc153a351659e4596acfc31f00bf594343cbfcd68 (patch)
treea9ed83de07711d6424fbea09aad28891bae5bfe4 /modules/vhack/pe/peertube
parenthosts/server3: Setup prometheus server in agent mode (diff)
downloadnixos-server-c153a351659e4596acfc31f00bf594343cbfcd68.zip
modules: Use namespaces
That might make it easier in the future to merge different server configs together (and thusly facilitate code-reuse.).
Diffstat (limited to 'modules/vhack/pe/peertube')
-rw-r--r--modules/vhack/pe/peertube/module.nix124
1 files changed, 124 insertions, 0 deletions
diff --git a/modules/vhack/pe/peertube/module.nix b/modules/vhack/pe/peertube/module.nix
new file mode 100644
index 0000000..e65e0b5
--- /dev/null
+++ b/modules/vhack/pe/peertube/module.nix
@@ -0,0 +1,124 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.vhack.peertube;
+in {
+ options.vhack.peertube = {
+ enable = lib.mkEnableOption ''
+ the peertube video platform.
+ '';
+ peertubeGeneral = lib.mkOption {
+ type = lib.types.path;
+ description = "The age encrypted general secret file passed to agenix";
+ };
+ smtpPasswordFile = lib.mkOption {
+ type = lib.types.path;
+ description = "The age encrypted smtp password file passed to agenix";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ services.peertube = {
+ enable = true;
+
+ configureNginx = true;
+ localDomain = "peertube.vhack.eu";
+ enableWebHttps = true;
+ listenWeb = 443;
+
+ smtp = {
+ createLocally = false;
+ passwordFile = "${config.age.secrets.peertubeSmtp.path}";
+ };
+ database = {
+ createLocally = true;
+ };
+ redis = {
+ enableUnixSocket = true;
+ createLocally = true;
+ };
+
+ secrets.secretsFile = "${config.age.secrets.peertubeGeneral.path}";
+
+ settings = {
+ signup = {
+ enabled = true;
+
+ limit = 10; # When the limit is reached, registrations are disabled. -1 == unlimited
+
+ minimum_age = 18; # Used to configure the signup form
+
+ # Users fill a form to register so moderators can accept/reject the registration
+ requires_approval = true;
+ requires_email_verification = true;
+ };
+ user = {
+ video_quota = "10GB";
+ video_quota_daily = "2GB";
+ };
+ auto_blacklist = {
+ videos = {
+ of_users = {
+ enabled = true;
+ };
+ };
+ };
+ listen.hostname = "127.0.0.1";
+ instance.name = "PeerTube at Vhack.eu";
+
+ admin.email = "admin@vhack.eu";
+
+ smtp = let
+ emailAddress = "peertube@vhack.eu";
+ in {
+ transport = "smtp";
+ hostname = "mail.foss-syndicate.org";
+ port = 587;
+ username = emailAddress;
+ tls = true;
+ disable_starttls = true;
+ from_address = emailAddress;
+ };
+ };
+ };
+
+ # The `configureNginx` option does not do this for some reason
+ # TODO(@bpeetz): Find out why <2024-06-27>
+ services.nginx.virtualHosts."${config.services.peertube.localDomain}" = {
+ enableACME = true;
+ forceSSL = true;
+ };
+
+ age.secrets = {
+ peertubeGeneral = {
+ file = cfg.peertubeGeneral;
+ mode = "700";
+ owner = "peertube";
+ group = "peertube";
+ };
+ peertubeSmtp = {
+ file = cfg.smtpPasswordFile;
+ mode = "700";
+ owner = "peertube";
+ group = "peertube";
+ };
+ };
+
+ vhack.persist.directories = [
+ {
+ directory = "/var/lib/peertube";
+ user = "peertube";
+ group = "peertube";
+ mode = "0700";
+ }
+ ];
+ users = {
+ users.peertube.uid = config.vhack.constants.ids.uids.peertube;
+ groups.peertube.gid = config.vhack.constants.ids.gids.peertube;
+ users.redis-peertube.uid = config.vhack.constants.ids.uids.redis-peertube;
+ groups.redis-peertube.gid = config.vhack.constants.ids.gids.redis-peertube;
+ };
+ };
+}