1 { lib, pkgs, config, ... }:
3 env = config.myEnv.tools.peertube;
4 cfg = config.myServices.websites.tools.peertube;
5 pcfg = config.services.peertube;
7 options.myServices.websites.tools.peertube = {
8 enable = lib.mkEnableOption "enable Peertube's website";
11 config = lib.mkIf cfg.enable {
12 services.duplyBackup.profiles.peertube = {
13 rootDir = pcfg.dataDir;
17 configFile = "/var/secrets/webapps/tools-peertube";
18 package = pkgs.webapps.peertube.override { ldap = true; };
20 users.users.peertube.extraGroups = [ "keys" ];
23 dest = "webapps/tools-peertube";
30 port: ${toString config.myEnv.ports.peertube}
33 hostname: 'peertube.immae.eu'
38 hostname: '${env.postgresql.socket}'
41 username: '${env.postgresql.user}'
42 password: '${env.postgresql.password}'
46 socket: '${env.redis.socket}'
52 url: ldaps://${env.ldap.host}/${env.ldap.base}
53 bind_dn: ${env.ldap.dn}
54 bind_password: ${env.ldap.password}
55 base: ${env.ldap.base}
57 user_filter: "${env.ldap.filter}"
60 sendmail: '/run/wrappers/bin/sendmail'
62 port: 465 # If you use StartTLS: 587
65 tls: true # If you use StartTLS: false
66 disable_starttls: false
67 ca_file: null # Used for self signed certificates
68 from_address: 'peertube@tools.immae.eu'
70 tmp: '${pcfg.dataDir}/storage/tmp/'
71 avatars: '${pcfg.dataDir}/storage/avatars/'
72 videos: '${pcfg.dataDir}/storage/videos/'
73 redundancy: '${pcfg.dataDir}/storage/videos/'
74 logs: '${pcfg.dataDir}/storage/logs/'
75 previews: '${pcfg.dataDir}/storage/previews/'
76 thumbnails: '${pcfg.dataDir}/storage/thumbnails/'
77 torrents: '${pcfg.dataDir}/storage/torrents/'
78 captions: '${pcfg.dataDir}/storage/captions/'
79 cache: '${pcfg.dataDir}/storage/cache/'
91 check_interval: '1 hour' # How often you want to check new videos to cache
92 strategies: # Just uncomment strategies you want
93 # Following are saved in local-production.json
96 size: 500 # Max number of previews you want to cache
98 size: 500 # Max number of video captions/subtitles you want to cache
100 email: 'peertube@tools.immae.eu'
106 requires_email_verification: false
113 video_quota_daily: -1
116 allow_additional_extensions: true
133 name: 'Immae’s PeerTube'
134 short_description: 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.'
137 default_client_route: '/videos/trending'
138 default_nsfw_policy: 'blur'
146 "# If you would like to report a security issue\n# you may report it to:\nContact: https://github.com/Chocobozzz/PeerTube/blob/develop/SECURITY.md\nContact: mailto:"
148 # You can provide a reporting endpoint for Content Security Policy violations
156 services.websites.env.tools.modules = [
157 "headers" "proxy" "proxy_http" "proxy_wstunnel"
159 services.filesWatcher.peertube = {
161 paths = [ pcfg.configFile ];
164 services.websites.env.tools.vhostConfs.peertube = {
165 certName = "eldiron";
167 hosts = [ "peertube.immae.eu" ];
172 RewriteCond %{REQUEST_URI} ^/socket.io [NC]
173 RewriteCond %{QUERY_STRING} transport=websocket [NC]
174 RewriteRule /(.*) ws://localhost:${toString env.listenPort}/$1 [P,NE,QSA,L]
176 RewriteCond %{REQUEST_URI} ^/tracker/socket [NC]
177 RewriteRule /(.*) ws://localhost:${toString env.listenPort}/$1 [P,NE,QSA,L]
179 ProxyPass / http://localhost:${toString env.listenPort}/
180 ProxyPassReverse / http://localhost:${toString env.listenPort}/
183 RequestHeader set X-Real-IP %{REMOTE_ADDR}s