1 { env, fetchedGithub, fetchurl, fetchzip, stdenv, writeText, pkgs, cacert }:
3 varDir = "/var/lib/peertube";
4 listenPort = env.listenPort;
6 # patchedPackages = stdenv.mkDerivation (fetchedGithub ./peertube.json // rec {
7 # patches = [ ./ldap.patch ];
10 # cp package.json yarn.lock $out/
13 # yarnModules = pkgs.yarn2nix.mkYarnModules {
14 # name = "peertube-yarn-modules";
15 # packageJSON = "${patchedPackages}/package.json";
16 # yarnLock = "${patchedPackages}/yarn.lock";
17 # yarnNix = ./yarn-packages.nix;
19 patchedServer = stdenv.mkDerivation (fetchedGithub ./peertube.json // rec {
26 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
27 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
29 yarn install --pure-lockfile
34 cp -a dist/server $out
36 buildInputs = [ pkgs.python pkgs.git pkgs.yarn pkgs.nodejs ];
38 webappDir = stdenv.mkDerivation rec {
41 name = "peertube-${version}";
43 url = "https://github.com/Chocobozzz/PeerTube/releases/download/${version}/${name}.zip";
44 sha256 = "18fp3fy1crw67gdpc29nr38b5zy2f68l70w47zwp7dzhd8bbbipp";
46 patches = [ ./ldap_yarn.patch ];
48 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
49 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
51 yarn install --production --pure-lockfile
52 rm -rf dist/server && cp -a ${patchedServer}/server dist
58 buildInputs = [ pkgs.yarn pkgs.git pkgs.python ];
63 port: ${env.listenPort}
66 hostname: 'peertube.immae.eu'
71 hostname: '${env.postgresql.socket}'
74 username: '${env.postgresql.user}'
75 password: '${env.postgresql.password}'
79 socket: '${env.redis.socket}'
81 db: ${env.redis.db_index}
85 url: ldaps://${env.ldap.host}/${env.ldap.base}
86 bind_dn: ${env.ldap.dn}
87 bind_password: ${env.ldap.password}
88 base: ${env.ldap.base}
90 user_filter: "${env.ldap.filter}"
93 sendmail: '/run/wrappers/bin/sendmail'
95 port: 465 # If you use StartTLS: 587
98 tls: true # If you use StartTLS: false
99 disable_starttls: false
100 ca_file: null # Used for self signed certificates
101 from_address: 'peertube@tools.immae.eu'
103 tmp: '${varDir}/storage/tmp/'
104 avatars: '${varDir}/storage/avatars/'
105 videos: '${varDir}/storage/videos/'
106 redundancy: '${varDir}/storage/videos/'
107 logs: '${varDir}/storage/logs/'
108 previews: '${varDir}/storage/previews/'
109 thumbnails: '${varDir}/storage/thumbnails/'
110 torrents: '${varDir}/storage/torrents/'
111 captions: '${varDir}/storage/captions/'
112 cache: '${varDir}/storage/cache/'
124 check_interval: '1 hour' # How often you want to check new videos to cache
125 strategies: # Just uncomment strategies you want
126 # Following are saved in local-production.json
129 size: 500 # Max number of previews you want to cache
131 size: 500 # Max number of video captions/subtitles you want to cache
133 email: 'peertube@tools.immae.eu'
139 requires_email_verification: false
146 video_quota_daily: -1
149 allow_additional_extensions: true
166 name: 'Immae’s PeerTube'
167 short_description: 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.'
170 default_client_route: '/videos/trending'
171 default_nsfw_policy: 'blur'
179 "# 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:"
181 # You can provide a reporting endpoint for Content Security Policy violations
189 inherit varDir webappDir config listenPort;