1 { lib, pkgs, config, ... }:
3 env = config.myEnv.tools.peertube;
4 cfg = config.myServices.websites.tools.peertube;
5 pcfg = config.immaeServices.peertube;
7 options.myServices.websites.tools.peertube = {
8 enable = lib.mkEnableOption "enable Peertube's website";
11 config = lib.mkIf cfg.enable {
12 myServices.chatonsProperties.hostings.peertube = {
13 file.datetime = "2022-08-21T20:00:00";
16 description = "Free software to take back control of your videos";
17 website = "https://peertube.immae.eu/";
18 logo = "https://peertube.immae.eu/client/assets/images/icons/icon-192x192.png";
21 status.description = "OK";
22 registration.load = "OPEN";
23 install.type = "PACKAGE";
26 myServices.chatonsProperties.services.peertube = {
27 file.datetime = "2022-08-21T20:00:00";
30 description = "Free software to take back control of your videos";
31 website = "https://peertube.immae.eu/";
32 logo = "https://peertube.immae.eu/client/assets/images/icons/icon-192x192.png";
34 status.description = "OK";
35 registration."" = ["MEMBER" "CLIENT"];
36 registration.load = "OPEN";
37 install.type = "PACKAGE";
41 website = "https://joinpeertube.org/";
42 license.url = "https://github.com/Chocobozzz/PeerTube/blob/develop/LICENSE";
43 license.name = "GNU Affero General Public License";
44 version = pcfg.package.version;
45 source.url = "https://github.com/Chocobozzz/PeerTube";
48 immaeServices.peertube = {
50 configFile = config.secrets.fullPaths."webapps/tools-peertube";
52 users.users.peertube.extraGroups = [ "keys" ];
54 secrets.keys."webapps/tools-peertube" = {
61 port: ${toString config.myEnv.ports.peertube}
64 hostname: 'peertube.immae.eu'
67 hostname: '${env.postgresql.socket}'
70 username: '${env.postgresql.user}'
71 password: '${env.postgresql.password}'
75 socket: '${env.redis.socket}'
80 sendmail: '/run/wrappers/bin/sendmail'
81 from_address: 'peertube@tools.immae.eu'
83 tmp: '${pcfg.dataDir}/storage/tmp/'
84 avatars: '${pcfg.dataDir}/storage/avatars/'
85 videos: '${pcfg.dataDir}/storage/videos/'
86 streaming_playlists: '${pcfg.dataDir}/storage/streaming-playlists/'
87 redundancy: '${pcfg.dataDir}/storage/videos/'
88 logs: '${pcfg.dataDir}/storage/logs/'
89 previews: '${pcfg.dataDir}/storage/previews/'
90 thumbnails: '${pcfg.dataDir}/storage/thumbnails/'
91 torrents: '${pcfg.dataDir}/storage/torrents/'
92 captions: '${pcfg.dataDir}/storage/captions/'
93 cache: '${pcfg.dataDir}/storage/cache/'
94 plugins: '${pcfg.dataDir}/storage/plugins/'
95 client_overrides: '${pcfg.dataDir}/storage/client-overrides/'
99 services.websites.env.tools.modules = [
100 "headers" "proxy" "proxy_http" "proxy_wstunnel"
102 services.filesWatcher.peertube = {
104 paths = [ pcfg.configFile ];
107 services.websites.env.tools.vhostConfs.peertube = {
108 certName = "eldiron";
110 hosts = [ "peertube.immae.eu" ];
115 RewriteCond %{REQUEST_URI} ^/socket.io [NC]
116 RewriteCond %{QUERY_STRING} transport=websocket [NC]
117 RewriteRule /(.*) ws://localhost:${toString env.listenPort}/$1 [P,NE,QSA,L]
119 RewriteCond %{REQUEST_URI} ^/tracker/socket [NC]
120 RewriteRule /(.*) ws://localhost:${toString env.listenPort}/$1 [P,NE,QSA,L]
122 ProxyPass / http://localhost:${toString env.listenPort}/
123 ProxyPassReverse / http://localhost:${toString env.listenPort}/
126 RequestHeader set X-Real-IP %{REMOTE_ADDR}s