1 { lib, pkgs, config, myconfig, ... }:
3 env = myconfig.env.tools.peertube;
4 cfg = config.services.myWebsites.tools.peertube;
5 pcfg = config.services.peertube;
7 options.services.myWebsites.tools.peertube = {
8 enable = lib.mkEnableOption "enable Peertube's website";
11 config = lib.mkIf cfg.enable {
14 configFile = "/var/secrets/webapps/tools-peertube";
15 package = pkgs.webapps.peertube.override { ldap = true; };
17 users.users.peertube.extraGroups = [ "keys" ];
20 dest = "webapps/tools-peertube";
27 port: ${env.listenPort}
30 hostname: 'peertube.immae.eu'
35 hostname: '${env.postgresql.socket}'
38 username: '${env.postgresql.user}'
39 password: '${env.postgresql.password}'
43 socket: '${env.redis.socket}'
45 db: ${env.redis.db_index}
49 url: ldaps://${env.ldap.host}/${env.ldap.base}
50 bind_dn: ${env.ldap.dn}
51 bind_password: ${env.ldap.password}
52 base: ${env.ldap.base}
54 user_filter: "${env.ldap.filter}"
57 sendmail: '/run/wrappers/bin/sendmail'
59 port: 465 # If you use StartTLS: 587
62 tls: true # If you use StartTLS: false
63 disable_starttls: false
64 ca_file: null # Used for self signed certificates
65 from_address: 'peertube@tools.immae.eu'
67 tmp: '${pcfg.dataDir}/storage/tmp/'
68 avatars: '${pcfg.dataDir}/storage/avatars/'
69 videos: '${pcfg.dataDir}/storage/videos/'
70 redundancy: '${pcfg.dataDir}/storage/videos/'
71 logs: '${pcfg.dataDir}/storage/logs/'
72 previews: '${pcfg.dataDir}/storage/previews/'
73 thumbnails: '${pcfg.dataDir}/storage/thumbnails/'
74 torrents: '${pcfg.dataDir}/storage/torrents/'
75 captions: '${pcfg.dataDir}/storage/captions/'
76 cache: '${pcfg.dataDir}/storage/cache/'
88 check_interval: '1 hour' # How often you want to check new videos to cache
89 strategies: # Just uncomment strategies you want
90 # Following are saved in local-production.json
93 size: 500 # Max number of previews you want to cache
95 size: 500 # Max number of video captions/subtitles you want to cache
97 email: 'peertube@tools.immae.eu'
103 requires_email_verification: false
110 video_quota_daily: -1
113 allow_additional_extensions: true
130 name: 'Immae’s PeerTube'
131 short_description: 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.'
134 default_client_route: '/videos/trending'
135 default_nsfw_policy: 'blur'
143 "# 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:"
145 # You can provide a reporting endpoint for Content Security Policy violations
153 services.myWebsites.tools.modules = [
154 "headers" "proxy" "proxy_http" "proxy_wstunnel"
156 security.acme.certs."eldiron".extraDomains."peertube.immae.eu" = null;
157 services.myWebsites.tools.vhostConfs.peertube = {
158 certName = "eldiron";
159 hosts = [ "peertube.immae.eu" ];
164 RewriteCond %{REQUEST_URI} ^/socket.io [NC]
165 RewriteCond %{QUERY_STRING} transport=websocket [NC]
166 RewriteRule /(.*) ws://localhost:${env.listenPort}/$1 [P,NE,QSA,L]
168 RewriteCond %{REQUEST_URI} ^/tracker/socket [NC]
169 RewriteRule /(.*) ws://localhost:${env.listenPort}/$1 [P,NE,QSA,L]
171 ProxyPass / http://localhost:${env.listenPort}/
172 ProxyPassReverse / http://localhost:${env.listenPort}/
175 RequestHeader set X-Real-IP %{REMOTE_ADDR}s